Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.dotnet.framework.interop,microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Problem interacting between VB.NET and VBA6 with Excel 2003

The following error

Run-time exception thrown :
System.Runtime.InteropServices.COMException - Error loading type
library/DLL.

happens while running the code listed at the bottom of this message in
the environment shown he

Operating System: Microsoft Windows Version 5.1 (Build
2600.xpsp_sp2_gdr.050301-1519 : Service Pack 2)

Visual Basic: MIcrosoft Visual Basic 6.3 Version 9972 VBA: Retail
6.4.9972 Forms3: 11.0.6550 (comes with Excel 2003)

The following library references are used in the VB.NET project:

Assembly Microsoft.Office.Interop.Excel
C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.E xcel\
11.0.0.0__71e9bce111e9429c\Microsoft.Office.Intero p.Excel.dll

Assembly office
C:\WINDOWS\assembly\GAC\Office\11.0.0.0__71e9bce11 1e9429c\
Office.dll

Assembly Microsoft.VisualBasic.Compatibility
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\
Microsoft.VisualBasic.Compatibility.dll

Assembly System
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\
System.dll

Assembly System.Data
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\
System.Data.dll

Assembly System.Windows.Forms
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\
System.Windows.Forms.dll

Assembly Interop.VBA
C:\vb\Nick\PlanningToolsModules\bin\
Interop.VBA.dll

Assembly Microsoft.Vbe.Interop

C:\WINDOWS\assembly\GAC\Microsoft.Vbe.Interop\11.0 .0.0__71e9bce111e9429c\
Microsoft.Vbe.Interop.dll


and the following "Imports" statements are included:

Imports Microsoft.Office.Interop.Excel
Imports Microsoft.Office.Interop.Excel.Constants
Imports Microsoft.Office.Interop.Excel.XlLookAt
Imports Microsoft.Office.Interop.Excel.XlSearchOrder
Imports Microsoft.Office.Interop.Excel.XlFindLookIn
Imports Microsoft.Office.Interop.Excel.XlDirection
Imports Microsoft.Office.Interop.Excel.XlAxisType
Imports Microsoft.Vbe.Interop
Imports Microsoft.Vbe.Interop.vbext_ComponentType

The code below is the relevant portion, extracted from a much larger
project Sub, hopefully enough to get a glimpse of what's happening.
In summary, it is VB.NET code accessing Excel VBA6 library objects to
control the Excel VBA environment. The purpose of the two odd
sections (first one showing a peculiar work-around) is in the first
instance to copy a source workbook project codemodule component, and
in the second, all project library references.

To me the most suspicious aspect of the problem lies in the fact the
crash occurs when accessing a VBComponent.Codemodule (in the first
instance) and a VBProject.Reference, both out of library
Microsoft.Vbe.Interop, and this all began after I had to switch from
picking up these objects through the VBIDE library to the
Microsoft.Vbe.Interop library.
_______________________________________________


Sub CreateCleanWorkbook()

Dim SourceReference As Reference, SourceProject As VBProject
Dim TargetProject As VBProject, SourceComponent As VBComponent
Dim TargetComponent As VBComponent, CheckRefName As String
Dim TargetRef As Reference, IsNewRef As Boolean, IsTheBook As
Boolean
Dim TargetComponents As VBComponents, SourceComponents As
VBComponents


SourceBook=Microsoft.Office.Interop.Excel..Applica tion.ActiveWorkbook
SourceProject = SourceBook.VBProject
SourceComponents = SourceBook.VBProject.VBComponents


TargetBook=Microsoft.Office.Interop.Excel..Applica tion.Workbooks.Add
TargetProject = TargetBook.VBProject
TargetProject.Name = SourceProject.Name
TargetComponents = TargetProject.VBComponents


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Interacting with 2 different excel files Trups Excel Discussion (Misc queries) 0 August 9th 07 04:52 AM
Problem interacting between VB.NET and VBA6 with Excel 2003 Nicholas Dreyer Excel Discussion (Misc queries) 0 April 6th 07 04:07 AM
Excel Capabilites when interacting with Outlook Corey Excel Programming 0 January 25th 07 02:04 AM
Interacting with Excel open in IE [email protected][_2_] Excel Programming 0 March 13th 06 12:54 AM
Interacting outside Excel Kevin Excel Programming 1 March 2nd 04 02:38 AM


All times are GMT +1. The time now is 10:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"