Macro doesn't work anymore - Same file, Same Word 2003 version

M

MJones

Hi All,

This macro worked in twelve different documents three weeks ago. Now
only part of it works. Any hints would be most appreciated. The only
updates would be any automatic updates made by Microsoft.

ClosePreview and PrintPreview still work, but FilePrintDefault does
not. This red box prints and the drawing objects check box is still
checked in Print Options.

Here's the code:

Dim mysetting
Sub FilePrintDefault()
' Prints the active document without drawing objects (red box)
mysetting = Options.PrintDrawingObjects
Options.PrintDrawingObjects = False
Dialogs(wdDialogFilePrint).Show
Options.PrintDrawingObjects = mysetting
End Sub
Sub FilePrintPreview()
' Previews the active document without drawing objects (red box)
mysetting = Options.PrintDrawingObjects
Options.PrintDrawingObjects = False
ActiveDocument.PrintPreview
End Sub
Sub ClosePreview()
' Turns drawing objects back on after exiting print preview
ActiveDocument.ClosePrintPreview
Options.PrintDrawingObjects = mysetting
End Sub

Thank you,

Michele
 
Z

zkid

Works fine on my end, although I placed the dimension statement for mysetting
within the FilePrintDefault subroutine.
 
M

MJones

No way! I've tried it on four different computers and can't get
FilePrintDefault to work. I moved the dimension statement, too, and no
go. I tried a blank file with just the macro and a text box, too. I'm
at a loss as to what to do now. Twelve documents are not useable until
I fix this. I've even tried both Word 2003 and 2002. It used to work
so I must have some setting somewhere changed. Please help!
 
T

Tony Jollans

Are you certain the macro is running?

Have you tried stepping through it and checking what happens line by line?
 
M

MJones

Figured it out! Thanks so much. Sometimes all you need is a hint.

When I stepped through it, it worked. Then I discovered that File >
Print is not the same thing as the print icon in the file toolbar.
File > Print is FilePrint() without the Default. So I made a duplicate
sub FilePrint() to sub FilePrintDefault() and its fine now. I must
have not tested it with this difference when I originally made the
macro so it really didn't stop working.

Thanks again,

Michele
--------------
 

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