Partilhar via


Visual Basic Concepts

Menu Design for ActiveX Documents

You can create your own menus for your ActiveX designer by using the Visual Basic Menu Editor. Containers that support ActiveX documents will also automatically merge any Help menu you create with the container's Help menu.

Tell Them Who You Are

When a user comes across your document — whether through a browser, binder, or other application — she may not immediately recognize it. For this reason, it is highly recommended that you always add an "About" menu to every ActiveX document you create.

You should also be aware that some containers will not display their menus correctly unless the ActiveX document merges a Help menu with the container's Help menu.

To merge an About box with the container's Help menu

  1. On the Project menu, click Add Form.

  2. In the Add Form dialog box, double-click the AboutBox with SysInfo icon to add an About Box form to the project.

  3. Set the Caption property of the form and Label controls appropriate to your ActiveX document.

  4. In the Project Explorer window, double-click your UserDocument to bring its designer forward.

  5. Click the UserDocument designer to select it, and on the Tools menu, click Menu Editor to display the menu editor dialog box.

  6. Click the Caption box and type &Help.

  7. Click the Name box and type mnuHelp.

  8. Click the NegotiatePosition box, and click Right.

  9. Click the Next button to create a new menu item.

  10. In the Caption box type "About" and the name of your ActiveX document.

  11. In the Name box type mnuAbout.

  12. Click the right-facing arrow button to indent the menu item.

  13. Click OK.

  14. Double-click your ActiveX designer to bring its Code window to the front.

  15. Add the following code to the mnuAbout Click event:

    Private Sub mnuAbout_Click()
        frmAbout.Show vbModal
    End Sub