Now we can customize any of the MS office products using the Add-Ins. In this article we will discuss about how to create an application level MS Project custom add-in and ribbon. This article will be more useful for those who are already working with custom MS Project Add-in.
Using the MS Project add-in we can create our own ribbon tabs, controls and functionality. Let us first look into how to create a simple Add-In for our MS Project.
1. Open visual studio and select “New Project” from File menu.
2. Select “Office à 2010” from installed template and “Project 2010 Add-in” project template.
3. This will add a set of files to out project. The default files added to the project is as below.
The main file is “ThisAddIn.cs”. By default this file has two events, one is “ThisAddIn_Startup” and other one is “ThisAddIn_Shutdown”. We will look into these events latter.
4. Adding Ribbon: Right click on the project and add new item and select “Ribbon (Visual designer)”.
5. Now, we will add few controls to our ribbon. For this sample, I am dragging a new button control to my ribbon.
6. Now, let us see how to handle the event related to the button. We can see the Design file (CustomRibbon.cs[Design]) from above screen and it has also code behind. To add event handler to button, just double click on it then event gets register and available in code behind file. I have written one line of code to display message box.
7. Now run the application. We can see the tab(Add-Ins) which is created by our code and can also modify the name. And we can also see the button and message box which is fired by the button click event.
In this article we discussed about creation of Add-in project and Ribbon through visual designer. This visual designer doesn’t provide more customization options like placing our custom images to controls, screen tip, super tip, enable/disable etc. But we can achieve it through Ribbon XML. We will discuss more on these kind of customization in my next article.