Hi all,
I am quite new to the VBA language, so please forgive me if I am not using the correct terms.
I have a table that has a column for File Path (Z:\) and another column for File Name (Test1.doc).
I am required to create a form where the user inputs a search keyword and it will run against all the File Names and open the document with the best match. However, I'm gonna take this step by step and figure out how to open specific word documents first.
I am currently using this code to open my word documents, however it only manages to open the Word application, not the document.
How do I go about correcting this code?
I am quite new to the VBA language, so please forgive me if I am not using the correct terms.
I have a table that has a column for File Path (Z:\) and another column for File Name (Test1.doc).
I am required to create a form where the user inputs a search keyword and it will run against all the File Names and open the document with the best match. However, I'm gonna take this step by step and figure out how to open specific word documents first.
Code:
Private Sub Command0_Click()
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim filepath As String
'Open Word
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
filepath = FPath & FName
'Open the file
Set wrdDoc = wrdApp.Documents.Open(filepath)
End Sub
How do I go about correcting this code?
Comment