Announcement

Collapse
No announcement yet.

Close Excel using COM without promt to save

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Nick Bourne
    replied
    Originally posted by John R. Heathcote View Post
    Take a look at the Excel "DisplayAlerts" method. You can turn off the annoying prompt from there as well.
    Thanks John, working perfectly now.

    Nick

    Leave a comment:


  • Michael Mattias
    replied
    >Take a look at the Excel "DisplayAlerts" method

    THAT's the one I (now) recall from a month ago.

    That may have been in the context of the way Excel handles ".csv" files... where it always asks if you want to save changes, even if you haven't made any changes (Excel has done that forever), but am certain it was something to do with "display alert" which was the solution.

    MCM

    Leave a comment:


  • John R. Heathcote
    replied
    Take a look at the Excel "DisplayAlerts" method. You can turn off the annoying prompt from there as well.

    Leave a comment:


  • Nick Bourne
    replied
    Thanks Michael, that looks like it will do the job for me.

    Nick

    Leave a comment:


  • Michael Mattias
    replied
    I know this came up here about a month ago, and there was some kind of thing you could do

    It may have been this......

    Code:
    'Enumeration XlSaveAction
    %xlDoNotSaveChanges                                     = &H00000002
    %xlSaveChanges                                          = &H00000001
    ...
    INTERFACE DISPATCH ExcelWorkbook
    .....
    
        MEMBER CALL CLOSE<&H00000115>(OPTIONAL IN SaveChanges AS VARIANT<&H00000000>, _
                OPTIONAL IN Filename AS VARIANT<&H00000001>, OPTIONAL IN RouteWorkbook AS VARIANT<&H00000002>)
    MCM

    Leave a comment:


  • Simon Morgan
    replied
    There's probably a more elegant solution, but you could always use COM to save to worksheet to a dummy file. Then close Excel and delete the dummy file.

    Leave a comment:


  • Nick Bourne
    started a topic Close Excel using COM without promt to save

    Close Excel using COM without promt to save

    Does anybody know if it is possible to close Excel without being asked to save the changes to the spreadsheet?

    I have an application that pushes data into various cells in Excel, allows it to make various calculations, reads results from other cells and then closes Excel using the commands:

    OBJECT CALL oExcelApp.ActiveWindow.Close
    OBJECT CALL oExcelApp.Quit

    However this results in a message box "Do you want to save the changes to xxxxx.xls?". I never want to save the spreadsheet. Excel is hidden as it is opened so there are no clues to the user that Excel is performing the calculations apart from this message box.

    Appreciate any help you can give me.

    Thanks

    Nick
Working...
X