Visual Studio Tools for Office 2007: How the Ribbon Helps Make Your Document a Dynamic Application
This brings back memories of what you used to develop earlier with Windows Forms or Web Forms. The user opens up a Windows application, selects a particular combination of data from the toolbar, and views the data in a grid. With the release of VSTO 3, developers can build that feature right into Office 2007 and simplify things when creating custom reports for business organizations. The organization wouldn't need sophisticated network servers or web applications to host their business applications.
Now that you have seen what your custom add-in will look like, it is time to get down to business and write code for this. Fire up Visual Studio 2008 and choose New Project. Select Office 2007 from the Projects tab, and Excel 2007 Add-in from the Templates tab. See Figure 3. Make sure that the .NET Framework 3.5 is selected from drop-down list box at the top. This is one of the new features in Visual Studio 2008 that allows you to target different versions of the .NET Framework.
Figure 3: Select the Excel Add-in from the dialog box.
Now, you need to include the Ribbon Designer to add your functionality. Right-click the project in Solution Explorer and choose New Item. Select Ribbon (Visual Designer) from the pop-up window, as shown in Figure 4.
Figure 4: Select the Ribbon (Visual Designer) from the dialog box.
Give it a name and press Enter. This will open the Ribbon Interface in Design view where you can add your custom controls and so forth, and write code to generate the business logic. In the middle, the Ribbon designer has replaced the custom Windows Form and the tool box now has a separate tab for the Office Controls, as seen in Figure 5. This enables the developer to drag and drop various .NET Controls on the Ribbon designer just like they would do on a Windows or Web form.
Figure 5: The Ribbon designer template opens inside Visual Studio 2008.
You will see a default group box on the Ribbon. This is where controls can be dragged and placed. Additional group box controls can be placed on the Ribbon. Now, drag and drop a drop-down list box and a button so that it looks like Figure 6.
Figure 6: Place the drop-down list box and button one below the other.
Page 2 of 5