I searched the Google to arrived at https://support.microsoft.com/en-us/kb/302901#appliesto
I went through the article and followed their steps strictly but met the following errors, though the article was on V.Studio 2003 while I'm using V.Studio 2010:
- The System.Windows.Forms.DLL mentioned on number 5 below, was not found, so I used the System.Windows.Forms under the .NET tab.
- Also, the CommandBarButton used in
private CommandBarButton MyButton;
at number 7 keeps giving me error. What do I do please?
Help me; Thanks.
STEP-BY-STEP EXAMPLE
1. On the File menu in Microsoft Visual Studio .NET, click New , and then click Project
2. In the New Project dialog box, expand Other Projects under Project Types , select Extensibility Projects , and then select the Shared Add-in template.
3. Type MyCOMAddin as the name of the add-in and then click OK.
4. When the Extensibility Wizard appears, follow these steps:
a. On page 1, select Create an Add-in using Visual C# , and then click Next.
b. On page 2, select the following host applications, and then click Next:
* Microsoft Word
* Microsoft PowerPoint
* Microsoft Outlook
* Microsoft Excel
* Microsoft Access
c. On page 3, provide a name and description for the add-in, and then click Next.
Note The name and the description of the add-in appear in the COM Add-in dialog box in the Office application.
d. On page 4, select all of the available options, and then click Next.
e. Click Finish .
5. On the Project menu, click Add Reference . Click System.Windows.Forms.DLL in the components list, click Select , and then click OK.
6. Add the following to the list of namespaces in the Connect class:
using System.Reflection
7. Add the following member to the Connect class:
private CommandBarButton MyButton;
8. Implement the code for the members of IDTExtensibility2 in the Connect class, as follows:
public void OnConnection(object application, Extensibility.ext_ConnectMode connectMode, object addInInst, ref System.Array custom)
{
applicationObject = application;
addInInstance = addInInst;
if(connectMode != Extensibility.ext_ConnectMode.ext_cm_Startup)
{
OnStartupComplete(ref custom);
}
}