A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

VSTO Excel 2003 to VB 6.0 Type mismatch



 
 
Thread Tools Display Modes
  #1  
Old November 30th, 2009, 09:49 AM posted to microsoft.public.word.newusers
Light
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

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


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