Need Help Printing a Word Document from an Excel Macro...
Posted by Bill Tanner on December 12, 1999 2:51 PM
I am not a programmer but I am trapped in a project
that requires programming. I've done okay but it's a good thing that
computers have gotten so fast because my code is so clunky that it would
choke an older computer or a programmer of any age.
Anyway, I am trying to print a Word document from an Excel macro. I did
a search on this site and saw one suggestion on the message board but it
didn't work for me. The code I used reads as follows:
Sub PrintWordDoc()
Dim AppWord As Word.Application
Set AppWord = GetObject("C:\My Documents\Word Documents\filename.doc")
With AppWord
.ActiveDocument.PrintOut Background:=False
.Quit SaveChanges:=False 'Quit & close without changes
End With
Set AppWord = Nothing 'release reference to it
End Sub
My problem is that I get a "Compile Error: User-defined type not
defined".
Would somebody please be so kind as to suggest a fix?
Thank you.
Bill Tanner