H
HeatherD
Hi! I'm hoping someone here can help me out with something that ha
been frustrating me for awhile...
I want to open a word document from excel (with a button) and if it i
not found i want the open file dialog box to appear for the user t
browse for the document in case it has been moved.
I have come up with the following code and it works well except i
opens two instances of word if the file is not found. if the file i
found, there are no problems. Does anyone know how to fix the code s
that only one instance of excel will be open??
Sub OpenWord()
MyDoc = "C:\Documents and Settings\dickisoh\Desktop\Work\CAA Yea
Change Instructions"
On Error GoTo C:
Set WdApp = CreateObject("Word.Application")
WdApp.Visible = True
WdApp.Documents.Open MyDoc
Set WdApp = Nothing
Exit Sub
C: Msg = MsgBox("The CAA Year Change Instructions file cannot b
found." & Chr(13) & "It may have been moved to another location."
Chr(13) & "Please browse your computer for the file.", vbOKOnly, "Fil
Not Found")
Call OpenWordDial
End Sub
Sub OpenWordDial()
Dim Wrd As New Word.Application
With Wrd.Dialogs(wdDialogFileOpen)
.Name = "*.doc"
.Show
End With
Set Wrd = Nothing
End Sub
Thanks so much in advance
been frustrating me for awhile...
I want to open a word document from excel (with a button) and if it i
not found i want the open file dialog box to appear for the user t
browse for the document in case it has been moved.
I have come up with the following code and it works well except i
opens two instances of word if the file is not found. if the file i
found, there are no problems. Does anyone know how to fix the code s
that only one instance of excel will be open??
Sub OpenWord()
MyDoc = "C:\Documents and Settings\dickisoh\Desktop\Work\CAA Yea
Change Instructions"
On Error GoTo C:
Set WdApp = CreateObject("Word.Application")
WdApp.Visible = True
WdApp.Documents.Open MyDoc
Set WdApp = Nothing
Exit Sub
C: Msg = MsgBox("The CAA Year Change Instructions file cannot b
found." & Chr(13) & "It may have been moved to another location."
Chr(13) & "Please browse your computer for the file.", vbOKOnly, "Fil
Not Found")
Call OpenWordDial
End Sub
Sub OpenWordDial()
Dim Wrd As New Word.Application
With Wrd.Dialogs(wdDialogFileOpen)
.Name = "*.doc"
.Show
End With
Set Wrd = Nothing
End Sub
Thanks so much in advance