What is the Difference Between VB and VBA?

Written by

Editorial Team

Reviewed by

Steve Rynearson

Last updated on July 19, 2021

What is the difference between VB and VBA?

VB (or Visual Basic) and VBA (or Visual Basic for Applications) for nearly all programming purposes are the same language. They are both derived from the same original programming language called Basic.   VBA however works within a ‘host’ application – like Word or Excel – it cannot work independently like VB can.

VBA is written in the VBE – the Visual Basic Editor.  In the Microsoft Office Environment (Word, Excel, PowerPoint, Access or Outlook), you can get to this editor by pressing Alt+F11 on your keyboard.

VBA 13 PIC 01


VB on the other hand is written in Visual Studio – you can either use VB 6.0 (which is very similar in syntax to VBA, or VB.Net (which is more updated and created to run with the .Net Framework that the latest software programs on computers use. Visual Basic can compile to an independent exe (executable) file whereas VBA forms and modules cannot, they require their host application in order to run.

VBA 13 PIC 02The Visual Basic 6.0 screen

What is VBS?

VBS (Visual Basic Script) is a scripting language that was modelled on VB and originally designed to add programming ability to web sites.   However nowadays it is used more by Windows-based server administrators to monitor tasks on computers.  You can create a vbs file which can run as an exe file does.  A vbs file can also be called to run from within VBA code.

You can create a simple vbs file using notepad.

  1. Open Notepad


2. Type the following.

Dim objFSO, objFSOText, objFolder
Dim strDirectory
strDirectory = "C:\Work"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.CreateFolder(strDirectory)
Wscript.Echo strDirectory & " folder created"

3. Click File, Save and type the name of the file including an extension of .vbs

VBA 13 PIC 04

4. You file should look like the icon below:

VBA 13 PIC 05

Running the file from within VBA

You may have a routine in VBA that relies on having a folder called Work on your user’s computer.  You can therefore call the vbs file from VBA to create this folder.

VBA 13 PIC 06

Click Run or press F5

VBA 13 PIC 07


VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro - A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users! vba save as

Learn More!

VBA Code Examples Add-in

Easily access all of the code examples found on our site.

Simply navigate to the menu, click, and the code will be inserted directly into your module. .xlam add-in.

(No installation required!)

Free Download

Return to VBA Code Examples