Accessing VBIDE.VBE.VBProjects via Excel in VB .NET Causes Excel To Crash When App Terminates 
Author Message
 Accessing VBIDE.VBE.VBProjects via Excel in VB .NET Causes Excel To Crash When App Terminates

I'm having a problem which I REALLY need to fix. If anyone could help I
would really appreciate it.

The problem arises when accessing the VBProjects object in an Excel
application (eg. Application.VBE.VBProjects) from .NET. As soon as you
do this, when the Excel application is termined it crashes. I've
included sample code to recreate the error.

Create a console project and reference Excel and VBIDE. Add the
following code:

    Public Sub Main()

        '**** Dimension Local Variables ****
        Dim XL As New Excel.Application()
        Dim VBProject As VBIDE.VBProject

        '**** Access VB Projects ****
        For Each VBProject In XL.VBE.VBProjects
        Next VBProject

        '**** Close Excel Application ****
        XL.Quit()
        XL = Nothing

    End Sub

When the application terminates and the garbage collection is called,
the Excel application crashes and returns:

    OleMainThreadWndName: excel.exe - Application Error
    The instruction at "0x77b26033" referenced memory at "0x01144a94".
The memory could not be read.

I'm running NT and Excel 98. To work around I'm currently calling a VB6
dll that performs the required task (stripping VBProjects from an Excel
workbook) but that is a less than perfect solution.

Please help.

*** Sent via Developersdex http://www.*-*-*.com/ ***
Don't just participate in USENET...get rewarded for it!



Sun, 16 Oct 2005 16:04:32 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Accessing VBIDE.VBE.VBProjects via Excel in VB .NET Causes Excel To Crash When App Terminates

2. Accessing VBIDE.VBE.VBProjects via Excel in VB .NET Causes Excel To Crash When Closed

3. Compatibility Problem Using MS Excel 97 VBA on Excel 2000/XP - Causes crashes

4. Help > Crash saving Excel through VB.Net

5. VB6 - Excel Export compiled under XP causes crash under W98

6. Problem with Excel's VBA: SQLOpen and SQLClose Cause Crash

7. Using excel via VB .NET

8. Help with writing Datagrid Contents back to EXCEL via VB.NET

9. Pasting Range from Excel 2002 via VBA to Word causes a New Workbook to open

10. VBE for excel as a Dev Tols (like VB in Visual Studio)

11. VBIDE and VBPROJECTS objects problem

12. Excel 2000 crashes when running macros created in Excel 97

 

 
Powered by phpBB® Forum Software