I am trying to print a word document from vba, but I keep getting an "Object variable or with block variable not set" error. Here is my code, the line in red is where I am getting the error:
Any insight on what the problem is would be appreciated.
Software Training, Implementation, Programming and Support for Macola Progression, Macola ES, Synergy, and Crystal Reports. Check out our Macola tools:
Code:
Private Sub btn1_click
Dim objDoc As Word.Document
Dim objWord As Word.Application
CreateObject ("Word.Application")
[red]Set objDoc = objWord.Documents.Open("C:\MyDirectory\12345.doc")[/red]
objDoc.PrintOut
objWord.Quit
End Sub
Any insight on what the problem is would be appreciated.
Software Training, Implementation, Programming and Support for Macola Progression, Macola ES, Synergy, and Crystal Reports. Check out our Macola tools: