The Stoat
The Grim Squeaker
- Local time
- Today, 11:07
- Joined
- May 26, 2004
- Messages
- 239
Hi all,
I've got a bit of an odd problem.
I'm trying to use this code to open a word document whose path is stored in the DB and displayed in a text box on my form.
When i click the cmd button the doc doesn't open but if i click the button again it says the document is open and locked for editing by me and gives me three options one of which is to view the doc in read only mode. If i select this then the document appears.
Any clues as to why i can't see it the first time of asking
Thanks
TS
I've got a bit of an odd problem.
I'm trying to use this code to open a word document whose path is stored in the DB and displayed in a text box on my form.
Code:
Private Sub CMD_OPEN_FILE_DIALOG_Click()
Dim WordObj As Object
Dim StrOpenFile As String
StrOpenFile = Nz(Me.TXT_COMPETENCY_PATH, "")
If StrOpenFile <> "" Then
Set WordObj = CreateObject("word.Application")
WordObj.Documents.Open StrOpenFile
Set WordObj = Nothing
End If
End Sub
When i click the cmd button the doc doesn't open but if i click the button again it says the document is open and locked for editing by me and gives me three options one of which is to view the doc in read only mode. If i select this then the document appears.
Any clues as to why i can't see it the first time of asking
Thanks
TS