Strange problem

  • Thread starter Thread starter Joe Cilinceon
  • Start date Start date
J

Joe Cilinceon

I have a form that lists several files that we print out when needed. These
are forms done in Word and saved to a forms folder. Now the problem is this
some of the forms (printed pages) ask if I want to save and some don't. The
code I use for this is below

Public Function PrintDoc(FileName)

Dim Name As String
Name = FileName

Dim WordObj As Object
Set WordObj = CreateObject("Word.Application")
WordObj.Documents.Open FileName
WordObj.PrintOut Background:=False
WordObj.Quit
Set WordObj = Nothing

End Function

Under the button properties for click I have the following line
PrintDoc("C:\Forms\DocumentName.doc")

As I said all of these forms are created in word and some do it (3) and
other just print the form with out a yes, no, cancel message box.

I'm using Office XP Developers. This has just started since I reinstalled
the software to a new computer.
 
Without knowing the contents of the documents I don't know why it's
requiring a save yes/no... but I think you can just force a 'no' by using...

WordObj.Quit false
 
What they are is a simple form that we have tenant's fill out. We print 1
then copy off as many as we need. No merge or any other thing involved. I
will give it a try though.
 
Back
Top