Granting Access to the VBA Project System

The very first time you create a VSTO project for Word and Excel, VSTO displays a dialog box informing you that the project must have access to the Visual Basic for Applications project system, as shown in Figure 2.5. You must click OK to create a VSTO project. If you click Cancel, the project will not be created.

Microsoft Visual Studio

Vou must explicitly enable access to the Microsoft Office Visual Basic for Applications project system before you can create or open a Visual Studio Tools for the Microsoft Office System project. By default access is disabled to help stop the spread of macro viruses. After enabling accessj you will still be protected by Microsoft Office macro security levels.

Do you want to allow access to the Visual Basic for Applications project system?

Figure 2.5. Allowing access to the Visual Basic for Applications project system

This dialog box appears only the first time you create a Word project and the first time you create an Excel project using VSTO. VSTO does not actually use Visual Basic for Applications, but it requires access to the VBA project system in order to support controls on the document.

After you have granted access to the VBA project system, the Excel workbook opens in Visual Studio with a number of windows open, such as Solution Explorer, the Properties window, and Toolbox, similar to the screen shown in Figure 2.6. If the Toolbox isn't open, you can open it by clicking the View menu and then clicking Toolbox. If you click the pushpin icon at the top of the Toolbox, the Toolbox remains open. This makes it easier for you to drag and drop controls onto the document.

Figure 2.6. Excel workbook open as the designer in Visual Studio
0 0

Responses

  • laila
    Do you want to allow access to the Visual Basic for Applications project system?
    7 years ago

Post a comment