Book Image

Excel Programming with VBA Starter

By : Robert F Martin
Book Image

Excel Programming with VBA Starter

By: Robert F Martin

Overview of this book

Do you have repetitive tasks that you would like to get rid of for good? Would you like to integrate Office Applications in order to streamline some of your tasks? Then look no further. This compact book will provide you with the knowledge to get your VBA programming off the ground and up to a comfortable cruising speed. "Excel Programming with VBA Starter" was born out of the need to have a short, but yet all-encompassing book that would give you a solid foundation in programming with Visual Basic for Applications. This book will enable you to harness the power of VBA in Excel and put it to good use throughout the course of your working day.Can't find properties and methods of an object? Don't know what a property, method or object is? Covering simple and advanced topics, create powerful, reusable examples such as IO, picking files from within Excel and automatically attaching them to e-mails. Learn and use the concept of encapsulation to condense code into bite-size methods to be easily accessed from within your projects, plus much more.
Table of Contents (8 chapters)

Recording a macro, adding modules, browsing objects, and variables

Before you get your hands "dirty" with coding in VBA, there are a few things you need to know. These things will help when it comes to coding. In this section, you will learn how to:

  • Record a macro

  • Add modules

  • Browse objects

  • Get some background on declaring variables

We will start with macro recording, a feature which is available in most Office applications.

Recording a macro

A macro, in Office applications, is a synonym for VBA code. In Excel, we can record almost any action we perform (such as mouse clicks and typing), which in turn is registered as VBA code. This can come in handy when we need to discover properties and methods related to an object. Let us now have a look at some ways you can record a macro in Excel. There are two options:

  1. Recording a macro from the status bar.

  2. Recording from the Developer tab.

Option 1 – Recording a macro from the status bar

From the status bar, click on the Record Macro button. If the button is...