+ Reply to Thread
Results 1 to 5 of 5

workbook.close savechanges:=True problem

  1. #1
    Dave the Wave
    Guest

    workbook.close savechanges:=True problem

    Hi:

    I have a workbook that opens up other workbooks, transfer some data, then
    closes the workbook using VBA.

    VBA Closing statement:

    wbkAnnual.close SaveChanges:=True, Filename:="BlahBlah.xls"
    note: wbkAnnual is a workbook object

    According to the documentation I've read, including the "savechanges:
    =filename" text to the close command prevents the "Save Changes Yes/No"
    dialog window from appearing. I vaguely remember this method working
    before, but not on this present workbook. Every time a workbook is closed
    by VBA the "Save Changes" dialog window appears.

    Is there a condition/s that overrides the "savechanges:=True" command?

    Does this only apply when the book being closed is the one that contains
    the VBA code?

    Any information will be greatly apreciated. Thanks!!

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Dave,

    There are 2 things you can do. First with wkbAnnual set the saved property to true before you save it.

    wbkAnnual.Saved = True

    Second, you can turn off Excels Alerts like this

    Application.DisplayAlerts = False

    Just be sure to re-enable them when you're done.

    Hope this Helps,
    Leith Ross

  3. #3
    Nick Hodge
    Guest

    Re: workbook.close savechanges:=True problem

    Dave

    As I presume you are using automation across office or even from another
    language, you could try

    xlApp.DisplayAlerts=False


    --
    HTH
    Nick Hodge
    Microsoft MVP - Excel
    Southampton, England
    [email protected]HIS


    "Dave the Wave" <[email protected]> wrote in message
    news:[email protected]...
    > Hi:
    >
    > I have a workbook that opens up other workbooks, transfer some data, then
    > closes the workbook using VBA.
    >
    > VBA Closing statement:
    >
    > wbkAnnual.close SaveChanges:=True, Filename:="BlahBlah.xls"
    > note: wbkAnnual is a workbook object
    >
    > According to the documentation I've read, including the "savechanges:
    > =filename" text to the close command prevents the "Save Changes Yes/No"
    > dialog window from appearing. I vaguely remember this method working
    > before, but not on this present workbook. Every time a workbook is closed
    > by VBA the "Save Changes" dialog window appears.
    >
    > Is there a condition/s that overrides the "savechanges:=True" command?
    >
    > Does this only apply when the book being closed is the one that contains
    > the VBA code?
    >
    > Any information will be greatly apreciated. Thanks!!




  4. #4
    Dave the Wave
    Guest

    Re: workbook.close savechanges:=True problem

    "Nick Hodge" <[email protected]> wrote in news:
    #[email protected]:

    > Dave
    >
    > As I presume you are using automation across office or even from

    another
    > language, you could try
    >
    > xlApp.DisplayAlerts=False
    >
    >

    First, I would like to thank you for your response.

    The entire application runs inside 1 instance of Excel. I originally
    tried turning off the "DisplayAlerts", but Excel would raise an error
    and not save the file. I removed the "DisplayAlerts=False" line -but
    left in the "SaveChanges:=True"- which caused the Save yes/no dialog
    window to show up. If I click Yes, everything works fine. So that is how
    I have left it at this time, but it bugs me when I don't understand what
    is going on.

    The Workbook which contains the VBA code is a small file (194k). The
    files that are controlled by the code are very large 6MB/ea. The large
    files contain very detailed quality information over the span of a
    calender year. There are over 20 worksheets, 14 charts, and hundreds if
    not thousands of equations in each 6MB file. I have seen some very
    strange behavior when exceeding Excel's limitations. This issue is so
    repeatable that I don't think the file size is the problem. I process
    only one large file at a time to avoid any memory issues.

    If you have any additional thoughts I would be happy to hear them.

    Thsnkd again.

    Dave the wave

  5. #5
    Nick Hodge
    Guest

    Re: workbook.close savechanges:=True problem

    Dave

    Could you paste a little more of the code?

    --
    HTH
    Nick Hodge
    Microsoft MVP - Excel
    Southampton, England
    [email protected]HIS


    "Dave the Wave" <[email protected]> wrote in message
    news:[email protected]...
    > "Nick Hodge" <[email protected]> wrote in news:
    > #[email protected]:
    >
    >> Dave
    >>
    >> As I presume you are using automation across office or even from

    > another
    >> language, you could try
    >>
    >> xlApp.DisplayAlerts=False
    >>
    >>

    > First, I would like to thank you for your response.
    >
    > The entire application runs inside 1 instance of Excel. I originally
    > tried turning off the "DisplayAlerts", but Excel would raise an error
    > and not save the file. I removed the "DisplayAlerts=False" line -but
    > left in the "SaveChanges:=True"- which caused the Save yes/no dialog
    > window to show up. If I click Yes, everything works fine. So that is how
    > I have left it at this time, but it bugs me when I don't understand what
    > is going on.
    >
    > The Workbook which contains the VBA code is a small file (194k). The
    > files that are controlled by the code are very large 6MB/ea. The large
    > files contain very detailed quality information over the span of a
    > calender year. There are over 20 worksheets, 14 charts, and hundreds if
    > not thousands of equations in each 6MB file. I have seen some very
    > strange behavior when exceeding Excel's limitations. This issue is so
    > repeatable that I don't think the file size is the problem. I process
    > only one large file at a time to avoid any memory issues.
    >
    > If you have any additional thoughts I would be happy to hear them.
    >
    > Thsnkd again.
    >
    > Dave the wave




+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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