Picture of How to: Make a message box using VBScript
In this "Instructable" I'll be showing you how to make a message box in Notepad using VBScript Coding.

Please Note: This is a completely harmless project and if something DOES go wrong, I will not be help responsible.

Remove these adsRemove these ads by Signing Up

Step 1: Step One

Picture of Step One
First thing to do is locate your Notepad.exe.
This application is on every windows computer OS and can be used for loads of interesting things.
Notepad.exe is normally located in Start Menu>All programs>Accessories

Step 2: Step Two: The code.

Picture of Step Two: The code.
For this next bit, it's fairly simple, because I do all the work.

x=msgbox("Your Text Here" ,0, "Your Title Here")

Make sure that the " is included in the text and replace the Your Text Here and Your Title Here. But don't change anything elese!

Advanced users can change something else.
  • 0 =OK button only
  • 1 =OK and Cancel buttons
  • 2 =Abort, Retry, and Ignore buttons
  • 3 =Yes, No, and Cancel buttons
  • 4 =Yes and No buttons
  • 5 =Retry and Cancel buttons
  • 16 =Critical Message icon
  • 32 =Warning Query icon
  • 48 = Warning Message icon
  • 64 =Information Message icon
  • 0 = First button is default
  • 256 =Second button is default
  • 512 =Third button is default
  • 768 =Fourth button is default
  • 0 =Application modal (the current application will not work until the user responds to the message box)
  • 4096 =System modal (all applications wont work until the user responds to the message box)
Change the "0" with any of these numbers above.

Step 3: Step Three: The Saving

Picture of Step Three: The Saving
Now for this bit, you would think that this is easy, but it's not as simple as Save As.

When you have finished the code, go to Save As and save it as: What You Want To Call It.vbs
At the end of the name, make sure that .vbs goes at the end and safe it anywhere.

Step 4: Step Four: Lets test it!

Picture of Step Four: Lets test it!
Now that we have completed the following steps, lets test it. Locate your safe file and dubble-click it. Lets see what the outcome was.

Step 5: Outcome.

Picture of Outcome.
The outcome of todays lesson was:

Your learned how Notepad.exe can become a powerfull scripting program
How to make a message Box
The values of Message Box's to make them look convincing.

Thank you for reading this lesson

DanG137 days ago

Fantastic. But how do I kill it after 1 second?

PrasunU8 days ago

I selected option as 4. like Yes and No. But I want an website to open if clicked NO.

Can you please help?

Attached is my vbs script.

CATW.vbs68 bytes
fabian.a made it!2 months ago

Did it! Thanks a lot. Now I can make error messages!

(removed by author or community request)

It's VBScript, A scripting language by Microsoft.

CarysC2 months ago


How to use this with newline?

MrSecurity1 made it!4 months ago

Here is something cruel you do to your friends (if you have any)! What this does is loops the box. So when they press "OK", it closes then opens again. Also, because it's "4096" it sits ontop of everything, just being awkward. Have fun!

MsgBox"Just here to be awkward!",4096,"Troll v6."
RthrG6 months ago

Don't put >"msgbox.vbs in the actual notepad, thats what you save it as, what I do is paste this MsgBox(" ",0+0," ") but of coarse there are no spaces in the final copy, then I just fill it in

um... yeah you got an error didn't you?

try this and then you will not have an error...

x=msgbox (“whatever you want message box to say here” ,0, ”title here”)
> “msgbox.vbs”

no, thats an error in a command line, you should had an error on one of your commands

jairo11 year ago
christophor or anyone, could you please give an example with more lines.

I created a batch file that works fine using the single line text format you gave, but I cannot get it to work with 2 or more lines. Your help would be greatly appreciated.

Ultimately, I'd like the .bat file to create the msgbox with title and multiple lines.
lemonie5 years ago
Notepad isn't a "powerful scripting program" it's a simple text-editor.

IMHO A simple Text editor is a powerful programming tool. It used to be all there was. If you know what you're doing, a text editor might be all you need.

try this from a windows command line. do it from a directory where you have write permissions.

c:\scripts> echo x=msgbox("Your text here." ,0,"Title here")>mbscript.vbs

c:\scripts> cscript mbscript.vbs

You've just written a vbscript without any text editor at all.
to add more lines use >> instead of > before the file name.

Notepad, edit, vi, emacs whatever you use, a text editor IS a powerful tool.
after it creates the mbscript.vbs file how do you write into the newly created vbs file with code?

lets say...within that file i want to create a code that tell a program to run
Tell me what you're trying to do. So I can answer the question most thoughtfully.

I think I understand, but I want to be sure before I write up a bunch of stuff you don't need.

using your code
c:\scripts> echo x=msgbox("Your text here." ,0,"Title here")>mbscript.vbs

it creates an empty vbs script called "mbscript" after it has done so, how do i write a code (from the same notepad i used to create the mbscript.vbs) in addition that fills the empty mbscript.vbs with a code to lets another program?
Make sure you're at the command prompt.

You can get there like this:

go to start
then run
then type CMD
and hit enter

that will open the command line. It's a black screen with a blinking cursor and something like

C:\>_ the underscore represents the cursor. you don't type "c:\>"

you type only the following that is between the outer most quotes.

"echo x=msgbox ("Your Text Here" ,0, "Your Title Here")>msgbox.vbs"

That will work. I just now did it.

when you type script msgbox.vbs you'll get a message box with an OK button.

i've only used the technique I've described in an emergency where I was in a unique situation. sometimes I use it to create batch file. it's because I use linux a lot and I'm used to the command line.

It's not really practical to write an entire script like that.
I suggest you use the Notepad.exe as described in this fine instructable.

or if you can't get to notepad you can type "edit" at the command prompt and you'll get a text based editor. Well, you will on XP anyway. I don't know about windows 7 for sure.

If you want to now how to program you should google "vbscript fundamentals" you should find the MSDN site for VBScript. Pretty much all you need to know is there.

If you want examples of vbscripts you should google. vbscript examples. you'll get tons of source code. but start with something basic as in simple or easy. at first and work your way up.

I hope this helps.

Let me know if you need anything else.


sorry you have to type

c script with no spaces. my spell checker keeps fix it for some reason.

you could click on it to run it if you use the windows interface.

probably you could just type msgbox.vbs and it will run.(after you've created it.)

good luck.
The power is in a person's mind, Notepad is a simple text-editor.

I agree with you. Notepad is a simple text editor. Nothing more and nothing less.

I think we can both agree, if you can't code with a simple text editor then you can't really code anyway.

But, let's say simple text editors represent the minimum standard in scripting tools.

What exactly would you say IS an example of "a powerful scripting program?" What makes it more powerful than (insert name of text editor here)?

I'm not being hostile. I really want to know. I use notepad and notepad ++ on a daily basis. They are both simple text editors at heart.

Notepad is great for filtering formatting codes from cut text. Cut from excel. Paste into notepad. Presto! Nice clean text. Cut it from notepad and paste it into whatever like.

I look forward to your reply.

Thanks, Lemonie.

- Chris

 Nice work but do you know how to make it so that if they click "no" it simply opens the message box again?
 yes, and also, there is a much easier way to make a msg box, open notepad, type in: msg * your text here  Voila!! i am not dissing the file in any way, just a suggestion for easier work. 
HandyBob5 years ago
As instructables goes, this is a good one (not counting the typos). Even newbies can understand it.
However hideous the idea, it is possible to program using notepad.

Maybe make a series on this, 'cause this one is a bit too simple.
How about a challenge. Program something using only notepad, an html app maybe? (aah sweet memories)  ;-)
Jack.Miller (author)  HandyBob5 years ago
Aye, just thought I would do a very, very simple one before I move onto some of the harder stuff I do. And typos... I was doing this at night time, so thats why there are -loads-.
You won't be help responsible, you'll be held responsible.