Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2003
    Location
    Ahmedabad
    Posts
    6

    Unanswered: OLE Automation Problem

    I am using OLE Automation for transfering some data in excel and formatting those data in excel.
    I am opening excel application, add some data, format those data and saving the xls with a file name.
    Now my problem is from the task manager EXCEL is not going though i am quiting the object and setting the object to nothing.

    sample code which i am using while closing the object is

    --- code for creating excel object used by me
    Dim xlapp As Excel.Application
    Dim xlworkbook As Excel.Workbook
    Dim xlworksheet As Excel.Worksheet
    Set xlapp = CreateObject("Excel.Application")
    Set xlworkbook = xlapp.Workbooks.Add
    Set xlworksheet = xlworkbook.Worksheets(1)

    --- code while i am closing/saving object.
    xlworkbook.Close True, str
    xlapp.Quit
    Set xlworksheet = Nothing
    Set xlworkbook = Nothing
    Set xlapp = Nothing

    can someone please help me

  2. #2
    Join Date
    Feb 2004
    Location
    Binary Universe
    Posts
    57
    "Now my problem is from the task manager EXCEL is not going though i am quiting the object and setting the object to nothing."

    Does this mean that excel app itself is still open in the task manager after you set objects to 'Nothing'? What does "EXCEL is not going ..." mean?

    A note:

    'xlworkbook.Close True, str' second argument 'str' is a file name. Does 'str' variable holds the 'path\file name'?
    Last edited by The Byte; 02-15-04 at 06:19.
    I won't byte... hard!

  3. #3
    Join Date
    Jun 2003
    Location
    Ahmedabad
    Posts
    6
    Originally posted by The Byte
    "Now my problem is from the task manager EXCEL is not going though i am quiting the object and setting the object to nothing."

    Does this mean that excel app itself is still open in the task manager after you set objects to 'Nothing'? What does "EXCEL is not going ..." mean?

    A note:

    'xlworkbook.Close True, str' second argument 'str' is a file name. Does 'str' variable holds the 'path\file name'?
    --------------------------

    Yes str has both path and filename...
    Yes EXCEL app itself is still open in the task manager....

    and the meaning of EXCEL not going from taskmanager means that the process of EXCEL is not killing itself and because of that when i run my code again it gives some silly error while formatting my report. if i kill that process from task manager then my code is working fine.

  4. #4
    Join Date
    Feb 2004
    Location
    Binary Universe
    Posts
    57
    Hmmm... I just copy'n'paste your code into a db and it worked as it should: closed Excel and killed the objects. So, it's not the code it's your computer. Anything else funky happens on your system?
    I won't byte... hard!

  5. #5
    Join Date
    Feb 2004
    Posts
    199
    when you have problem like this you can use API, you can find a process via window caption and kill it via API functions.
    MDB, ADP <-> MS SQL + VBA, ADO & RDO, .NET, Oracle, Java/Jsp.

Posting Permissions

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