Freigeben über


Troubleshooting Outlook COM Addins – Using VBScript

Since Office uses COM to create Addins and _IDTExtensibility2 inherits from IDispatch it is available to scripting clients, a common technique I use to troubleshoot COM Addins are to see if I can create the component manually via a vbscript.  Use the following code to check whether or not COM can create your component:

<code>

 
Option Explicit

Dim objAddin
' Set this equal to the ProgId of your Addin
const ProgId = "Sample1.Connect"

Set objAddin = CreateObject(ProgId)

If Not objAddin Is Nothing Then
    WScript.Echo "Successfully created your Addin!"
    Set objAddin = Nothing
Else
    WScript.Echo "Error creating your Addin!" & _ 
    Err.Description & " " & Err.Number
End If

</code>

Change the ProgId constant to be specific to your Addin’s ProgId and that is all that is needed.  Just save this code off to the file system and give it a .vbs extension and run the script using the following command:

cscript.exe <filename> **

 

** If you are running on a 64 bit system make sure you run the cscript.exe from %Systemroot%\SysWow64 and not %Systemroot%\System32.