Closing excel application.

Discussion in 'AutoCAD' started by KingCAD, Jul 24, 2003.

  1. KingCAD

    KingCAD Guest

    Okay, I'm back. I have an AutoCAD VBA routine that opens the selected Excel spread sheet,gathers the necessary information to create the drawing and then closes Excel. Tha problem is that Excel presents me with the "do you wanmt to save the changes?" dialog and won't close until I click on "NO". The code I am using to close is
    ObjExcel.Quit
    Set ObjExcel = Nothing
    Set ObjExcelSheet = Nothing
    Isn't there a way to tell Excel to simply close without saving?

    Thanks.

    Dave. K
     
    KingCAD, Jul 24, 2003
    #1
  2. KingCAD

    Kevin Terry Guest

    you didn't list how you are referencing the document itself, so if you don't already have a reference to it then you'll have to make one (basically, close the document before you close the application)



     



    ObjExcelBook.Close False



     



    you can also turn off all dialogs like this:



    ObjExcel.DisplayAlerts = False




    Kevin



    "KingCAD" <> wrote in message news:...

    Okay, I'm back. I have an AutoCAD VBA routine that opens the selected Excel spread sheet,gathers the necessary information to create the drawing and then closes Excel. Tha problem is that Excel presents me with the "do you wanmt to save the changes?" dialog and won't close until I click on "NO". The code I am using to close is
    ObjExcel.Quit
    Set ObjExcel = Nothing
    Set ObjExcelSheet = Nothing
    Isn't there a way to tell Excel to simply close without saving?

    Thanks.

    Dave. K
     
    Kevin Terry, Jul 24, 2003
    #2
  3. KingCAD

    fheub Guest

    This might help ("Close False" closes without saving)

    Dim exlBook As Excel.Workbook

    For Each exlBook In objExcel.Workbooks     exlBook.Close False Next exlBook



    fheub
     
    fheub, Jul 24, 2003
    #3
  4. KingCAD

    KingCAD Guest

    Makes sence to me! I'll give it a shot as soon as I can get back to that project.

    Thanks alot guys.

    Dave. K
     
    KingCAD, Jul 24, 2003
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.