+ Reply to Thread
Results 1 to 7 of 7

Closing a Word document without saving

  1. #1
    Forum Contributor
    Join Date
    02-26-2009
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    286

    Closing a Word document without saving

    From Excel I have generated a Word document and saved this as a PDF file. I now wish to close the Word document without saving.
    I have tried the code below but the Word document remains open!

    What code should I be using?

    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,466

    Re: Closing a Word document without saving

    Comment out the On Error and see what happens when you run the close.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    02-26-2009
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    286

    Re: Closing a Word document without saving

    That does not work, I get a run time error 448!

  4. #4
    Forum Contributor
    Join Date
    02-26-2009
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    286

    Re: Closing a Word document without saving

    I have solved the problem (with help on the internet) by savivg the document to a tempory file.

    Please Login or Register  to view this content.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,466

    Re: Closing a Word document without saving

    That does not work, I get a run time error 448!
    That was the whole point. The On Error was masking the failure; now you can see it ... and fix it. Just because you hide the error doesn't mean it avoids or ignores the problem ... nothing happens.

    I have solved the problem (with help on the internet) by savivg the document to a tempory file.
    That doesn't look like it would be a temporary file.

    Maybe use:
    Please Login or Register  to view this content.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  6. #6
    Forum Contributor
    Join Date
    02-26-2009
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    286

    Re: Closing a Word document without saving

    Thanks for the input. Cheers Sandy.

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,466

    Re: Closing a Word document without saving

    You're welcome. Thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Copy bitmap to specific word document, preferably without closing it.
    By Skeidser in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-12-2020, 11:01 AM
  2. Closing A Word Document WIth Excel VBA
    By Jenn68 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-28-2017, 05:29 PM
  3. saving and closing word doc's created from worksheets
    By tryer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-30-2011, 05:43 AM
  4. Trouble closing MS Word document from Excel macro
    By Cumberland in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-17-2007, 01:00 PM
  5. closing a word document
    By natanz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-02-2006, 06:35 PM
  6. [SOLVED] Closing a workbook without saving from Word
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-09-2005, 05:05 PM
  7. closing word without saving in sequence after sending email - help please!!!
    By rabbi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-16-2005, 08:08 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1