Strange problem

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.
 
R

Rob Oldfield

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
 
J

Joe Cilinceon

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top