Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2003
    Posts
    33

    Unanswered: Close Excel.Application object..not working

    Help!! I need to open an excel.application object from Access but I am having a difficult time closing that object after I have use it. I want to open it in one form and then close it in another form when it is no longer usable.

    I have tried

    myExcelApp.quit and it is not working. Please can anyone help me???

    thanks
    Gina

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Here's what I use... It hasn't failed me yet:
    I call this procedure from many different parts of the App. That's why I use Public to declare the variables.

    Public ObjXL_APP As Excel.Application, ObjXL_BOOK As Excel.Workbook
    Public ObjXL_SHEET As Excel.Worksheet

    Sub Close_XL(bolSave As Boolean)
    'save the workbook, or it won't close
    If bolSave Then
    ObjXL_BOOK.Save
    Else
    'even if you don't want to save it, tell the system that it's saved
    ObjXL_BOOK.Saved = True
    End If
    ObjXL_APP.Quit
    Set ObjXL_APP = Nothing
    Set ObjXL_BOOK = Nothing
    Set ObjXL_SHEET = Nothing
    End Sub
    Inspiration Through Fermentation

  3. #3
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    One thing I did notice is this:

    Dim myExcelApp As Object

    Did you try changing that to:

    Dim myExcelApp as Excel.Application

    in both instances?

    If that doesn't work, hopefully someone else will step in, since I'm
    going on vacation for a week, starting in about 5 more minutes!
    Inspiration Through Fermentation

  4. #4
    Join Date
    Jul 2003
    Posts
    33
    Thank you for your help. I figured it out.

Posting Permissions

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