Help with 'Save' command in VBA

E

EllenM

Hello,

I am trying to create a macro that saves a file after the file has been
printed to avoid the prompt which typically appears onscreen which asks the
user if they want to save the current open file. As you know, Word will
prompt you to save a file that you had already saved if you attempt to close
the file after it has been printed. Printing the file seems to store printer
data into the file which of course would technically count as a changed file,
subsequently prompting the user to save changes. I try to avoid this message
prompt with the “ActiveDocument.Save†command at the last line of the
subroutine below. The problem is that it does not seem to work. I am still
prompted to save anyway even when saving after programmatically invoking the
print command. Can someone shed some light on this? Thanks!

If ActiveDocument.Saved = True Then
Application.PrintOut Filename:="", Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=True,
PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0

ActiveDocument.Save
End If


Ellen
 

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