Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2013-06-24
2
Medium Priority
?
462 Views
Last Modified: 2013-06-24
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
Comment
Question by:SCMHC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 39272732
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
 

Author Closing Comment

by:SCMHC
ID: 39272965
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you work with Word a lot, you probably use styles. If you use styles a lot, you've probably balled your fist more often than not when working with the ribbon. In Word 2007/2010, one of the things that I find missing when using styles is a quic…
Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question