LJtechnical
Technical User
I have the following code which should open a word document with the filename given from a field name within my form. It all seems to work properly until the code reaches the
Set wrdDoc = wrdApp.Documents.Open(strFileNm) Line, here it comes up with message saying Run Time Error 5174 File could Not be Found. Any body any ideas?
____________________________________________________________
Private Sub Command92_Click()
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim strFileNm
Dim msg As String
Set wrdApp = New Word.Application
With FileSearch
Do
strFileNm = Forms![Front End a]!Proposal '& ".doc"
.NewSearch
.MatchTextExactly = False
.SearchSubFolders = True
.Filename = Dir(strFileNm)
.LookIn = "C:\My Documents\CMQ Database v1.0\Proposals"
.Execute
msg = "Filename not valid, Please try again:"
Loop While .FoundFiles.Count = 0
End With
Set wrdDoc = wrdApp.Documents.Open(strFileNm)
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Open(strFileNm) Line, here it comes up with message saying Run Time Error 5174 File could Not be Found. Any body any ideas?
____________________________________________________________
Private Sub Command92_Click()
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim strFileNm
Dim msg As String
Set wrdApp = New Word.Application
With FileSearch
Do
strFileNm = Forms![Front End a]!Proposal '& ".doc"
.NewSearch
.MatchTextExactly = False
.SearchSubFolders = True
.Filename = Dir(strFileNm)
.LookIn = "C:\My Documents\CMQ Database v1.0\Proposals"
.Execute
msg = "Filename not valid, Please try again:"
Loop While .FoundFiles.Count = 0
End With
Set wrdDoc = wrdApp.Documents.Open(strFileNm)
wrdApp.Visible = True