What is a VBA Module and How is a VBA Module Used?

What is a VBA Module and How is a VBA Module Used?

Microsoft Excel VBA Tutorial

A VBA module is where you type your VBA code for your Microsoft Excel VBA workbook project.

What is a VBA Module?

  • VBA code is stored and typed in the VBA Editor in what are called modules
    • As stated on the VBA Editor page, a collection of modules is what is called a VBA project
    • Every major Microsoft Office product has a VBA Editor and can use VBA code to control itself
    • The VBA Editor can be activated by pressing the Alt+F11 keys in a Microsoft Office product
  • VBA modules come in three different types, when just starting, you will be typing in a standard module
  • To view a module, just double click on its icon in the Project Explorer window in the VBA Editor
    • For example, if you wanted to view the Module3 module then just double click on it with your mouse. This is illustrated in the picture below. A VBA module will resemble a Word document in both organization and typing.
    • A VBA module will appear in its own window within the VBA Editor when you double click on it to view it
    • A VBA module basically works like a Word document and follows the same basic typing rules
VBA Editor, VBA Module, VBA Procedure

VBA Module (Click to Enlarge)

  • You type code in a module then run it to control the program you want to control
    • For a program to be controlled with VBA it just has to be what is called VBA compatible. It does not have to be a Microsoft product
      • For example the code pictured above is designed to command Microsoft Excel
    • You can be in Microsoft Excel and control Word or Access or vice versa. Remember, it does not matter where the VBA module resides (i.e. what program), it is the code that controls whatever you are trying to command not its location.
  • The code you type in a module comes from what can be referred to as a library
    • Programs expose their libraries to VBA allowing VBA to control them
    • Want to command a program, then reference its library in VBA then learn its commands so you can type them in your modules
  • In Microsoft Excel, modules located under the Modules folder or Classes folder can be removed by right mouse clicking on their icons in the Project Explorer window and selecting Remove.
    • When removing a module, you have the choice to save it

We Can Teach These Skills to You - Our Microsoft Excel VBA Training

Beginning Microsoft Excel VBA Training for Business

Beginning Excel VBA Training for Business Professionals

Our 2-day "hands-on" beginning Microsoft Excel VBA training shows you the essential Excel VBA programming skills that you need to immediately develop useful powerful data processing and analytical tools that your business needs now. View Outline

Advanced Microsoft Excel VBA Training for Business

Advanced Excel VBA Training for Business Professionals

Our 3-day "hands-on" advanced Microsoft Excel VBA training shows you how to build advanced data processing tools, analysis tools and dashboard displays using Microsoft Excel VBA that will solve the most difficult business tasks. View Outline

Beginning Microsoft Excel VBA Training for Engineers and Scientists

Beginning Excel VBA Training for Engineers and Scientists

Our 2-day "hands-on" beginning Microsoft Excel VBA training shows you how to use Excel VBA to control key Excel engineering and science features, format and process technical data, perform sophisticated calculations, create technical charts, create custom worksheet functions, manage large models and data, create report tools and much more. Taught by an engineer. View Outline

Advanced Microsoft Excel VBA Training for Engineers and Scientists

Advanced Excel VBA Training for Engineers and Scientists

Our 3-day "hands-on" advanced Microsoft Excel VBA training shows you how to use Excel VBA to build advanced engineering and science tools that that solve your most difficult data and analysis tasks and help you visualize your data sophisticated interfaces. Taught by an engineer. View Outline



Site Map

Copyright © 2002-2015

EMAGENIT All Rights Reserved