jvhazelbaker
Programmer
I am trying to run a Word document when clicking a button on an Access form. The code I am using is:
________________________________________________________
Private Sub Command16_Click()
Dim LWordDoc As String
Dim oApp As Object
'Path to the word document
LWordDoc = "s:\red\homeplace\standards.doc"
If Dir(LWordDoc) = "" Then
MsgBox "Document not found."
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
End Sub
_____________________________________________________
When I click the button, I receive the error:
_____________________________________________________
Run Time Error '-2147024770(8007007e)':
Automation Error
The specified module could not be found.
_____________________________________________________
When I click 'debug' this line in the code is highlighted:
Set oApp = CreateObject(Class:="Word.Application")
I don't know what could be wrong with the code. It was working fine. Any ideas?
________________________________________________________
Private Sub Command16_Click()
Dim LWordDoc As String
Dim oApp As Object
'Path to the word document
LWordDoc = "s:\red\homeplace\standards.doc"
If Dir(LWordDoc) = "" Then
MsgBox "Document not found."
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
End Sub
_____________________________________________________
When I click the button, I receive the error:
_____________________________________________________
Run Time Error '-2147024770(8007007e)':
Automation Error
The specified module could not be found.
_____________________________________________________
When I click 'debug' this line in the code is highlighted:
Set oApp = CreateObject(Class:="Word.Application")
I don't know what could be wrong with the code. It was working fine. Any ideas?