|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
How to: Interact with Windows Forms
Some code examples in this topic use the this or Me keyword or the
You can add Windows Forms to your Visual Studio Tools for Office projects the same way you do in other projects in Visual Studio. For more information, see. The following example uses an Excel workbook project.
The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see.
To display a Windows Form
Add a Windows Form to your project. In this example, the Windows Form is called
ThisWorkbookin Solution Explorer and select View Code.
Add code to
ThisWorkbook_Startupto create a new instance of the form and call the method to display the modal form.
You can also use themethod to show a non-modal form.