VBScript Message Box Function – 3 Steps Only To Create!

People might thought that “notepad.exe” is just a notepad. What if I told you that you can use it to create VBScript Message Box?

In this article, I will show you the easiest steps to create a message box using VBScript.

VBScript Message Box Syntax

Even though VBScript is already exists since years ago, you still can use it on latest Windows version. The only syntax or programming line is x=msgbox([prompt],[button],[title]).

  • Prompt. This is the dialogue or the content box.
  • Button. Button/Action to display. But only use constant or value in the MsgBox Constants
  • Title. This is where the title for the message box.

How To Create VBScript Message Box

1 – Create new “text document” or text file using notepad.

You can simply right click on your desktop, then navigate to “New >”, then click “Text Document”

2 – Enter the syntax into text file.

As mentioned before, enter the msgbox syntax into text file. For example, you can enter syntax like this >> x=msgbox(“This is my text”,0,”Title Here”).

3 – Save the file as VBS.

At the top of notepad, click “File > Save As”. Choose where would you like to save the VBScript file. In this example, I will save the file at my Desktop.

Then rename the file as what you want. Before you click save, you need to change on two things as below:

  • change the file format to .vbs
  • select “All Files” for save as type
  • select encoding “ANSI”

Once done changed, click save.

Voila! Now your message box is done.

Now locate where you save the VBScript file. You should see the file like this.

Once found, double click on that file. A message box will show as how you set.

For your information, the button is not limited to “OK” button only. There are other Constants that you can try.

Constants Value Description
VBOKOnly0Show OK button
VBOKCancel 1Show OK and cancel buttons
VBAbortRetryIgnore2Show abort, retry, ignore buttons
VBYesNoCancel3Show yes, no cancel buttons
VBYesNo4Show yes, no buttons
VBRetryCancel5Show retry, cancel buttons
VBCritical16Show critical message icon
VBQuestion32Show warning query button
VBExclamation48Show warning message icon
VBInformation64Show information message icon
VBDefaultButton10First button is default
VBDefaultButton2256Second button is default
VBDefaultButton3512Third button is default
VBDefaultButton4768Fourth button is default
VBApplicationModal0Demands that the user respond to the dialog before allowing continuation of work in current application
VBSystemModal4096Causes suspension of all applications until the user responds to the dialog

Thanks for reading this article. Hopefully you find it helpful. Just a friendly reminder, all this guide is for education purpose. “GeekZag.com” will not responsible if anyone misuse information referred from this article and use it for bad intention.

If you liked this article, then please
our Facebook page to get recent updates.
Share to your friends:

Leave a Comment