Results 1 to 4 of 4
  1. #1
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Avoid Save Prompt (Word/VBA)

    I am reviewing a lot of text files and have some code to open selected file(s) in Word. The code opens all of these text files as Readonly, and I do not make any changes, but when I close the Word window by clicking on the X in the upper-right, I get an anoying prompt: "This document contains formatting that cannot be saved in text format. Do you want to save the changes?" I assume that I get this because I have done a Page Setup and/or doc compare so that I can review the document(s) easily. Is there a flag that tells Word that the document has changed? Can I set this to false to avoid the close prompt? I know that I could save the document objects and close them w/o a prompt in the master document, but I usually have more than one window open, so this would take a bunch of code, so I was hoping to just add one line to the existing macro,. TIA --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  2. #2
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Avoid Save Prompt (Word/VBA)

    Never mind, the brain finally kicked into gear and I remembered the Saved property. wdDoc.Saved = True works a treat. No more pop-up! --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Avoid Save Prompt (Word/VBA)

    You could set the Save property of the document (file) to True after opening it, but if you perform a Page Setup or something like that, it will set Saved to False again.

  4. #4
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Avoid Save Prompt (Word/VBA)

    I do the PageSetup in code and then set the Saved property to True, and finally exit the macro. When I review the doc I only use find, lne/page down, so the exit does not prompt. Thanks! --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •