Results 1 to 4 of 4

Thread: Excel.EXe Object

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    oXL.Quit
    Set oXL = Nothing

    Should do the trick. Are you sure you are opening only one instance of Excel? Sometimes people have both:

    Set oXL = New Excel.Application
    set oXL = CreateObject("Excel.Application")

    or something similar and they actually open two instances of Excel. Make sure you only use one. You might want to post your code so we can look at it.

  2. #2
    New Member
    Join Date
    May 2000
    Location
    Crowthorne UK
    Posts
    14

    Question

    This is the bit of code that I use to open the book I need??

    Is this correct???

    Set oExcelApp = CreateObject("EXCEL.APPLICATION")
    Set oWs = oExcelApp.ActiveSheet

    Set MyBook = Workbooks.Open(FileName:="c:\Book1.XLS")

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2000
    Location
    Fresno, California, USA
    Posts
    195
    Try this:

    Dim oExcelApp As Excel.Application

    Set oExcelApp = CreateObject("EXCEL.APPLICATION")
    oExcelApp.Workbooks.Open ("c:\Book1.XLS")

    oExcelApp.ActiveWorkbook. do whatever

    oExcelApp.Workbooks.Close
    oExcelApp.Quit
    Set oExcelApp = Nothing

    You have to reference your workbooks and worksheets within the oExcelApp. In the new way of doing Office automation, you don't have separate stand-alone objects for each worksheet or workbook. They are all gotten to through the oExcelApp object.

    By the way, I have tested this code and it deletes the Excel process.

  4. #4
    New Member
    Join Date
    May 2000
    Location
    Crowthorne UK
    Posts
    14

    Cool

    Cheers HDR worked a treat. Must be where we were trying to open an application and then a workbook as seperate objects!
    this has also solved the problem we had with saving the book a number of contiguous times!
    Thanks

Posting Permissions

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



Click Here to Expand Forum to Full Width