This document explains how to create a VB.NET application using the Strategy Office API. In general, to call Strategy Office from a .NET assembly, a developer must use the Strategy Office .NET assembly as the reference, not the COM type library.
The COM type library (Program Files\MicroStrategy\Office\moimain.tlb) is generated by .NET to allow COM applications to call Strategy Office, which a is .NET assembly. Since the type library was generated from an assembly, it can't be used as a COM reference by another .NET application. That is, when attempting to reference the COM type library from a .NET assembly, Visual Studio .NET cannot generate the interop assembly to call COM.
A .NET reference needs to be added to the VB.NET application from Program Files\MicroStrategy\Office\moimain.dll, not a COM reference from Program Files\MicroStrategy\Office\moimain.tlb.
Below is a VB.NET code snippet that shows how to initialize Strategy Office using the .NET API:
Dim office As MSTROfficeInterface.MOIOffice
Dim status As MSTROfficeInterface.EnumMOIErrorStatus
office = New MSTROfficeInterface.MOIOffice
office.Initialize(Nothing, status)
if status = MSTROfficeInterface.EnumMOIErrorStatus.MOISuccess Then
MessageBox.Show("Success")
End If
Here's the equivalent in VB using the COM API:
Dim office As MOIOffice
Dim status As EnumMOIErrorStatus
Set office = New MOIOffice
office.Initialize Nothing, status
If status = EnumMOIErrorStatus_MOISuccess Then
MsgBox "Success"
End if