Is it possible to tell Access to not only open Word, but to open a specific document in Word? When I try that, I get told it's an invalid command. But I am able to open up Word.
Thanks for your responses! I chose not to do a hyperlink because I want more than just a document to open. First I turn the warnings off, then SQL runs to make a table (deleting the previous table of the same name.), then I open the appropriate document in word (already set up to mail merge to the table I just made), then I turn warnings back on and close out of Access so the mail merge is possible. The only thing not working is calling up the particular document.
Randy, I tried what you suggested, but it tells me the file is not found. It must be something in the way I did the punctuation or something, because I just copied the file name and path from the document itself so it wouldn't have typos. Here's what I have--do you have any ideas?
Regarding a launch from Access:
Here's one I did with a control ... has a little bit of error handling. Cares where Word file is but does not care where app is ...
Private Sub RunMswordInScool_Click()
Dim LWordDoc As String
Dim oApp As Object
'Path to the word document
LWordDoc = "c:\letters\iss.doc"
If Dir(LWordDoc) = "" Then
MsgBox "The Document was not found. Check Letters folder on C:\"
Else
'Create an instance of MS Word
Set oApp = CreateObject(Class:="Word.Application")
oApp.Visible = True
'Open the Document
oApp.Documents.Open filename:=LWordDoc
End If
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.