Link to home
Start Free TrialLog in
Avatar of sjayendra
sjayendra

asked on

Excel Automation

I have developed one excel automation application in vb. It works fine in vb ide. But when i compile it and run in exe. It gives error like

 Microsoft Excel excel.exe Application Error
The instruction at "0X77ab1955" referenced at "0X00159945",

The memory could not be read


Waiting for reply
thanks


Avatar of mahesh_mp
mahesh_mp

send some deatils jayendra of your code













Versions? Object Librarys?
Avatar of sjayendra

ASKER

references
   MS Excel 9.0 Object library
   MS ADO 2.6 library
   MS Office Web Components 9.0


global module :
    public AppExcel as Excel.Application
    public WrkBook as Excel.Workbook
    public WkSheet as Excel.WorkSheet


Form Load:
   Set AppExcel = New Excel.Application
   Set WrkBook  = AppExcel.workbooks.Add
   Set xlSheet = Wrkbook.Worksheet(1)

  'som code

form exit btn
   AppExcel.quit
  Set AppExcel = nothing

 In exe everything works fine only when I execute Exit Btn code
 It gives err msg.
 
   
Are you running it on the same computer?  Try putting error handlers in each procedure like this:

Sub Whatever_Procedure()

    On error goto Trap_Error

'functional code...

    Exit Sub 'Exit if we dont get an error otherwise we go to next line

  Trap_Error:

    Msgbox Err.Description
    MsgBox Err.Number

End Sub

the program is crashing because you may not be freeing the objects before releasing the application object
free the objects in a proper sequence ie first the charts, then worksheet, then workbook then the app. ie free the child before the parent.
ASKER CERTIFIED SOLUTION
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial