B
Bill Stanley
I'm trying to automate word; at first, with very simple code:
********
Sub automateWord()
Dim wordApp As Word.Application
' Create new hidden instance of Word.
Set wordApp = New Word.Application
' Show this instance of Word.
wordApp.Visible = True
With wordApp
' Code to automate Word here.
End With
wordApp.Quit
Set wordApp = Nothing
End Sub
************
I have set a reference to the Word Object Library.
When the code encounters the "Set" statement, I get the following error
message:
"Run-time error '-2147221231 (80040111)
Automation Error
ClassFactory cannot supply requested class"
If I substitute Excel for Word, everything works as expected.
What am I missing here?
********
Sub automateWord()
Dim wordApp As Word.Application
' Create new hidden instance of Word.
Set wordApp = New Word.Application
' Show this instance of Word.
wordApp.Visible = True
With wordApp
' Code to automate Word here.
End With
wordApp.Quit
Set wordApp = Nothing
End Sub
************
I have set a reference to the Word Object Library.
When the code encounters the "Set" statement, I get the following error
message:
"Run-time error '-2147221231 (80040111)
Automation Error
ClassFactory cannot supply requested class"
If I substitute Excel for Word, everything works as expected.
What am I missing here?