[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Excel 2000 interop: manifest and COM-error

Christian Schmidt

7/10/2007 7:38:00 PM

Hi all,
I'm trying to add functions to Excel 2000 via VBA's Declare. I have
declared the interface in VBA and the C++/CLI-dll ("Excel-AddIn.dll")
works normally, if I use standard types and SAFEARRAY, __stdcall and a .def.

After adding a reference to Excel9.olb (creates Interop.Excel.1.3.dll,
Office.dll and VBIDE.dll) and using Excel::Range within a procedure, I
have problems loading the Excel-AddIn.dll, because Interop.Excel.1.3.dll
or one of it's descendants cannot be found. If I copy the interop-dlls
to the Excel directory, the dll can be loaded.

Question 1:
I assume I have to modify the Excel-AddIn.dll.manifest file to give the
correct location of the interop-dlls. How?

If my Dll exports a function with Excel::Range^ as an argument (no more
__stdcall possible) I get a 0x80004005 COM-error.

Question2:
What's the problem here?


Thanks for any ideas,
Christian


Example
=======
VBA:
Public Declare Function SumMe Lib "Debug\Excel-AddIn.dll" Alias "SumMe"
(ByRef r As Range) As Double

Private Sub Workbook_Open()
ChDrive Me.Path
ChDir Me.Path
End Sub


C++/CLI:
extern "C" {
double SumMe(Excel::Range^ r) {
..
}