How to Make a Menu in VBS

Updated April 17, 2017

VBS, a subset of Visual Basic, allows you to create Web-based and desktop applications quickly. Although VBS has no user interface controls, it can still display HTML buttons, labels and even menus when used with HTA. HTA, short for HTML Applications, serves as a wrapper for VBS. Using these technologies together, you can add useful menus and other controls to your VBS applications.

Open Notepad and paste the following code into a new document:

HTA Test

This creates a basic HTA document named "VBS Menu." The code between the "" tags adds a drop-down menu containing five values.

Add the following code after the "" tag:

This adds a VBS subroutine that runs when you select a menu item. This code stores the index of the item that you choose in "menuItems." For instance, if you choose item two from the menu, "menuItems" will have a value of "2." The "selectedText" variable holds the text value of the selected menu item.

Click "File" and select "Save As" to open Notepad's "Save As" window.

Type "My_VBS_Menu_Test.hta" in the "File Name" box and click "Save." This will save the document as an HTA application.

Open Windows Explorer and navigate to the folder containing the file that you saved. Double-click the file. A window will open and display the VBS menu.

Click the drop-down arrow and select an item. The code will execute and display the value that you select.


In this simple example, the VBS subroutine simply displays the selected menu item. You can perform tasks that are more useful by examining the selected menu item's value and executing other functions. For instance, if you create a menu containing file names, you might open a file, depending on the value that a user selects from the VBS menu.

bibliography-icon icon for annotation tool Cite this Article

About the Author

After majoring in physics, Kevin Lee began writing professionally in 1989 when, as a software developer, he also created technical articles for the Johnson Space Center. Today this urban Texas cowboy continues to crank out high-quality software as well as non-technical articles covering a multitude of diverse topics ranging from gaming to current affairs.