Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default VSTO Excel 2003 to VB 6.0 Type Mismatch

Hi,

I have an Addin 2003 Application. In this Application I'm calling an VB 6.0
Dll and I send Excel Application Object as Parameter. In VB Project I'm using
Workbook_Open event with WithEvents. I have a messagebox there. Unfortunately
when i call VB dll , I get this Error Message -- Type mismatch.

Is there any Idea?

Code in VS2008 :
private Project1.Class1 vbapp;

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
#region VSTO generated code

this.Application =
(Excel.Application)Microsoft.Office.Tools.Excel.Ex celLocale1033Proxy.Wrap(typeof(Excel.Application), this.Application);

#endregion

vbapp = new Class1();
object myAppObject = Globals.ThisAddIn.Application;
try
{
vbapp.AttachApplication(ref myAppObject);
}
catch (Exception ex)
{
}

Code in VB:
Dim WithEvents mExcelApp As Excel.Application

Public Sub AttachApplication(xlApp As Object)
Set mExcelApp = xlApp

End Sub

Private Sub mExcelApp_NewWorkbook(ByVal Wb As Excel.Workbook)
Call MsgBox("New Workbook opened")
End Sub

Private Sub mExcelApp_WorkbookOpen(ByVal Wb As Excel.Workbook)
Call MsgBox("Excel WorkBook opened" + Wb.Name)
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default VSTO Excel 2003 to VB 6.0 Type Mismatch

VSTO + VB6 = unusual !

Where are you "calling" your VB6 (some public procedure in a public class in
the VB6 ActiveX dll that you have instanciated in VSTO presumably) and on
what line do you get the error. Or do you mean the VB6 withevents class is
up and running and errors in an mExcelApp event.

Regards,
Peter T


"light" wrote in message
...
Hi,

I have an Addin 2003 Application. In this Application I'm calling an VB
6.0
Dll and I send Excel Application Object as Parameter. In VB Project I'm
using
Workbook_Open event with WithEvents. I have a messagebox there.
Unfortunately
when i call VB dll , I get this Error Message -- Type mismatch.

Is there any Idea?

Code in VS2008 :
private Project1.Class1 vbapp;

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
#region VSTO generated code

this.Application =
(Excel.Application)Microsoft.Office.Tools.Excel.Ex celLocale1033Proxy.Wrap(typeof(Excel.Application),
this.Application);

#endregion

vbapp = new Class1();
object myAppObject = Globals.ThisAddIn.Application;
try
{
vbapp.AttachApplication(ref myAppObject);
}
catch (Exception ex)
{
}

Code in VB:
Dim WithEvents mExcelApp As Excel.Application

Public Sub AttachApplication(xlApp As Object)
Set mExcelApp = xlApp

End Sub

Private Sub mExcelApp_NewWorkbook(ByVal Wb As Excel.Workbook)
Call MsgBox("New Workbook opened")
End Sub

Private Sub mExcelApp_WorkbookOpen(ByVal Wb As Excel.Workbook)
Call MsgBox("Excel WorkBook opened" + Wb.Name)
End Sub



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
Excel 2003 - Combobox.AddItem type mismatch Mario[_10_] Excel Programming 1 January 22nd 07 02:31 PM
Type Mismatch: array or user defined type expected ExcelMonkey Excel Programming 4 July 6th 06 03:40 PM
Type mismatch using rnge as Range with Type 8 Input Box STEVE BELL Excel Programming 11 December 3rd 05 05:02 AM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
Excel VBA - Type mismatch during While sub_pop Excel Programming 5 July 23rd 04 11:42 PM


All times are GMT +1. The time now is 01:02 AM.

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

About Us

"It's about Microsoft Excel"