Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Jan 2003
    Location
    Central Florida, USA
    Posts
    505
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Saving Spreadsheet via VBA (2003)

    I thought this had been asked and answered before, but I cannot find it. I have opened a spreadsheet via VBA. I go to close it, and save it, but am prompted with "This file was created using a later version of Excel. There is a remote possibility that certain workbook properties specific to the later version may be lost if you save the file in this version."
    The answer will ALWAYS be "OK", so is there a way to avoid the prompt, or automatically send an "OK"? Below is the code I use to exit the function:

    Exit_FormatSpreadsheet:
    Set xlSourceRange = Nothing
    Set xlColPoint = Nothing
    Set xlChartObj = Nothing
    ' Close and save the workbook
    xlWrkbk.Close SaveChanges:=True
    Set xlWrkbk = Nothing
    ' Quit Excel
    xlApp.Quit
    Set xlApp = Nothing
    Exit Function


    Thanks in advance for your consideration.


    Ken

  2. #2
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Saving Spreadsheet via VBA (2003)

    Add the line in <font color=blue>blue</font color=blue>
    ....
    ' Quit Excel
    <font color=blue>xlApp.DisplayAlerts=False</font color=blue>
    xlApp.Quit
    Set xlApp = Nothing
    Exit Function

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

    Re: Saving Spreadsheet via VBA (2003)

    The line mentioned by mbarron should be inserted above the line in which the workbook is saved:

    ...
    ' Close and save the workbook
    xlApp.DisplayAlerts = False
    xlWrkbk.Close SaveChanges:=True
    ...

  4. #4
    4 Star Lounger
    Join Date
    Jan 2003
    Location
    Central Florida, USA
    Posts
    505
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: Saving Spreadsheet via VBA (2003)

    Thanks to both of you. It worked great!

Posting Permissions

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