Learn VBS Programming for Pranks, Cool Stuff, Ect. (2024)

Introduction: Learn VBS Programming for Pranks, Cool Stuff, Ect.

By JfieldcapVisit my Channel!

More by the author:

About: I love creating value, and discovering new things! I take things apart to see how they work, spend too much time learning about irrelevant things, and love making cool stuff, like Robots, electronic projects i… More About Jfieldcap »

This instructable is to teach you thew basics of Batch and VBS programming, whether you want to make a talking clock, a simple calculator program, or just need a few ideas for April fools. ;)

VBS is a programming language built into windows. Have you ever wondered how to make a window pop up and say anything you want it to? Have you ever wanted to scare your friends or parents with a really convincing fake virus? Make someone think their computer is sentient? What about make your computer talk to you?

If so, you've come to the right place! :D

A ton of credit goes to Super_Nerd and his Awesome instructable, thanks for such a detailed and comprehensive guide, and for a lot of the information in this instructable.

Note: These will only work on windows machines. Sorry, mac users. :/

Step 1: The Begining Basics: Your First Message Box

Surprisingly, there is very little to do for our first message box.

First, open notepad,

Next, type this in (Or copy/Paste)

x=msgbox("Message", 0 ,"Message along the top")

You can replace the Message and Message along the top with whatever you like. Keep the parenthesis though.

Click File, then Save as

Make sure you select "All files (*.*)" instead of "Text Documents (*.txt)" before saving, otherwise it will save it as a plain text document.

Type the name you want to save it as, followed by a .vbs

Save the file, then run it. If you did everything correctly, you should see a message box pop up on the screen! Now you can move on to customizing icons and buttons!

Step 2: The Begining Not So Basics: Adding Buttons and Icons!

Ok, so you've made your first message box pop up. Great! Now how do you add more buttons, options, and icons?

Did you notice the zero in the line here?

x=msgbox("Message", 0 ,"Message along the top")

The numbers there define what buttons and icons appear.

For the buttons:

0 - ok button

1 - ok and cancel

2 - abort, retry and ignore

3 - yes no and cancel

4 - yes and no

5 - retry and cancel

For the icons:

16 - critical message icon

32 - warning icon

48 - warning message

64 - info message

To use these, simply add the numbers to the code like this:

If I wanted a warning icon and yes and no buttons, I would write this:

x=msgbox("Is this a warning?", 4+32 ,"Warning!")

The number for the buttons goes first, then a plus sign, and then the icon number.

Now you should know how to add different buttons and icons to your message box!

Step 3: Have Fun With Message Boxes!

Ok! Now that you now the basics, you can prank your friends, awe them with your supreme skills of computer hacking, or just play around with it for fun!

A tip:

This is the code for the message boxes shown in the pictures for this step:

x=msgbox("When your computer talks back to you, then you know you're going crazy.", 48+2 ,"Perhaps this is just your imagination.")
y=msgbox("Actually, I think you really do need to see a doctor. Or maybe I should call an asylum?", 16+0 ,"A doctor would be recomended.")

Notice I put both commands in one file. You can do this, and they will play one after the other.

Step 4: Make Your Computer Talk to You!

So you want your computer to talk to you? It's very easy! Another simple VBS script, and it will be talking away!

Open notepad.

Copy in this code:

'
set speech = Wscript.CreateObject("SAPI.spVoice")

speech.speak "Hello Master, I am ready to do your bidding."

You can replace the "Hello Master, I am ready to do your bidding." part with whatever you like. Same as with the message boxes, keep the parenthesis.

Click File, then Save as
Make sure you select "All files (*.*)" instead of "Text Documents (*.txt)" before saving, otherwise it will save it as a plain text document. Type the name you want to save it as, followed by a .vbs, then save it.

Run it and 'see' (Hear) the results!

Step 5: Text Input Window:

Here's how to make a window that accepts a text input from you.

Type this into Notepad:

var=inputbox ("Text in window","text at top of window","default text")

The variable var is where the input is stored.

This doesn't do much by itself, but you can add it to other things to make something cool!

Step 6: Inspiration, Ideas, and Tips

If this has been enough for you, then good! I hope it helped! If not, I hope to add more later, but for now, take a look at Super_Nerd's very detailed instructable on the subject: https://www.instructables.com/id/The-Ultimate-VBS-T...

To make a VBS (Or Batch) file run when the computer
has been started up and logged onto, find the Startup folder under All Programs, and put your file(s) into it. When your unsuspecting victim logs on, they will be greeted by it!

Other cool things:

Text to speech program:

x=inputbox ("Enter text to convert into speech:","Text to speech convertor","Enter text")
' set speech = Wscript.CreateObject("SAPI.spVoice") speech.speak x

Password Program:

x=inputbox ("Please Enter Password","Please enter Password","")
if x = "Pizza is the Password" then x=msgbox("Correct! Welcome, Master!", 0 ,"Welcome, Master!") else x=msgbox("Incorrect.", 0+16+0+4096 ,"Password Fail") end if

I hope this instructable helps some people, comments and constructive criticism are always welcome! ;D

Learn VBS Programming for Pranks, Cool Stuff, Ect. (5)

Participated in the
Coded Creations

Learn VBS Programming for Pranks, Cool Stuff, Ect. (2024)

FAQs

Can I learn VBA in 2 days? ›

If you want to, you can learn excel VBA in one week, by spending an hour each day. With some extra time for practicing. However, I would recommend doing it a bit slower, say 2-3 videos a day, with lots of coding practice.

How difficult is VBA to learn? ›

Although learning VBA requires time and perseverance, this flexible language is relatively easy to learn due to its straightforward syntax. Most individuals can master VBA basics in as little as a few weeks with regular study. Of course, this timeframe depends on several factors.

What is the best source to learn VBA? ›

Many top education providers like Coursera and Udemy have free online VBA training materials. VBA is included in most Microsoft Office applications without needing an additional download or fee. If you want to learn more about VBA, Noble Desktop provides comprehensive in-person and live online training options.

What is harder VBA or Python? ›

It might be that for a beginner without any coding experience that Python is easier to learn compared to VBA. Python syntax is easy to read, you can start coding without declaring any variable, and due to the external libraries, you don't have to write complex algorithms by yourself.

Is VBA easier than SQL? ›

Data is much safer in SQL data storage than in Excel, since it's more difficult for a user to delete data by mistake. You can automate Excel using Visual Basic for Applications (VBA), but VBA isn't as easy a language to learn as SQL.

Is Excel VBA still worth learning? ›

So the answer to your question,” is Excel VBA still worth learning?” is yes. Excel VBA is still worth learning for people looking to automate their day-to-day tasks to increase work efficiency. Learning VBA is the easiest way to customize Excel, and create custom functions by writing codes and scripts in Excel.

Are VBA programmers in demand? ›

Demand for Perl, VBA, and C++ developers has the most momentum. It's also interesting to examine which software skills are becoming more or less expensive.

What coding language is VBA most like? ›

VBA is a scripting language (because it is interpreted and not compiled) like Python, which has been included in the Microsoft (MS) Office suite since the mid 1990s and is derived from the BASIC programming language.

Is VBA in high demand? ›

It's in demand in finance. You won't believe how huge this demand is. People still use calculators and then enter the total values in Excel table instead of using the most basic formulas.

Where can I learn VBA for free? ›

Free Excel VBA Tutorial - Learn VBA in 67 Minutes | Udemy.

What can I learn instead of VBA? ›

In summary, if your focus is on automating and customizing Microsoft Office applications, then VBA is likely the better choice. However, if you need a more general-purpose programming language that can be used for a variety of tasks, then Python may be the better option.

What is better than Excel VBA? ›

VBA might be the go-to for quick, Excel-specific tasks, while Python could be the better choice for more complex data manipulations or when working within a broader data analysis workflow.

What is Microsoft replacing VBA with? ›

Looks like Microsoft is treating Office Script as a replacement for VBA. Targeting to automation progress in Excel.

Can Python do everything VBA can? ›

Everything you can write in VBA can be done in Python. This page contains information that will help you translate your VBA code into Python.

Is VBA a valuable skill? ›

- Knowledge of VBA can set you apart in the job market. Many employers value candidates who can automate processes, create efficient workflows, and enhance productivity using tools like Excel with VBA. It can be a valuable addition to your skill set, especially in roles that involve data analysis and reporting.

Can you learn Excel in 2 days? ›

Although it's possible to gain a basic understanding of Excel's interface and core functions in just a few hours, it can require additional time and study to master its more complex capabilities. It takes most Excel users approximately 18-20 hours to fully learn this spreadsheet application.

Is VBA faster than Excel? ›

Second rule: Use the most efficient function possible

Lookups on sorted data can be tens or hundreds of times more efficient than lookups on unsorted data. VBA user-defined functions are usually slower than the built-in functions in Excel (although carefully written VBA functions can be fast).

Is VBA good for beginners? ›

Learning Excel and VBA is considered to be easier than other programming languages due to its understandable syntax and clean editor layout. Many users can quickly transfer the skills they learn working with VBA in Excel into other Office apps, such as PowerPoint or Word.

Is VBA the easiest programming language? ›

VBA is a beginner-friendly programming language to learn because of its simple characteristics and in-house applications. It is fully integrated into Microsoft Office programs, so no additional software or packages are required.

Top Articles
Latest Posts
Article information

Author: Stevie Stamm

Last Updated:

Views: 5876

Rating: 5 / 5 (60 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Stevie Stamm

Birthday: 1996-06-22

Address: Apt. 419 4200 Sipes Estate, East Delmerview, WY 05617

Phone: +342332224300

Job: Future Advertising Analyst

Hobby: Leather crafting, Puzzles, Leather crafting, scrapbook, Urban exploration, Cabaret, Skateboarding

Introduction: My name is Stevie Stamm, I am a colorful, sparkling, splendid, vast, open, hilarious, tender person who loves writing and wants to share my knowledge and understanding with you.