Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 468
  • Last Modified:

Why does the save diaglog box appear when the document is opened for printing only. No changes to the document was made.

I have several word documents that I open, print and close from an Excel macro.  The macro works perfectly except for on document which hangs up because before the document closes, the save dialog box opens and is waiting for a response.  I have re-typed this document several times and each time this document does the same thing.  How can I get this document to close without saving.  I have unchecked everything in the Options.  Below is the vba code and attached is the document.
thanks all for the assist.

Dim TotDocs As Integer
Dim MyDoc As String

Sub Button1_Click()
TotDocs = Sheets("Info").Range("a1")
For Count = 1 To TotDocs
    MyDoc = Sheets("Documents").Range("A" & Count)
    Set wrdApp = CreateObject("word.application")
    Set wrdDoc = wrdApp.Documents.Open(MyDoc)
    wrdDoc.PrintOut
    wrdDoc.Close
    wrdApp.Quit
Next Count

End Sub
305a---Appendix-A-Self-Preservat.docx
0
SCMHC
Asked:
SCMHC
1 Solution
 
GrahamSkanCommented:
I don't know why, but there are a couple of things to try:
Firstly you can set the Saved property to True:
    wrdDoc.Saved = True
    wrdDoc.Close
    wrdApp.Quit

Open in new window

and/or you can add a parameter to the Close:
    wrdDoc.Close wdDoNotSaveChanges
    wrdApp.Quit

Open in new window

0
 
SCMHCAuthor Commented:
thank you so, so much...that works perfectly...I was so wrapped up in solving why the document needed to be saved, I couldn't see the tree through the forest...
thanks again :-)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now