VBA for Dummies (with CD-ROM)

( 1 )


Here's a concept -- writing hot computer programs that actually do useful things! VBA, the programming language built into numerous software applications from Microsoft Office to Visio and AutoCAD, is the ideal tool to personalize your VBA-enabled programs to suit your own home or office needs.

With VBA and a copy of VBA For Dummies, you can tweak the way your applications look and work with all the confidence of a master programmer...and without all the drudgery of typing ...

See more details below
Available through our Marketplace sellers.
Other sellers (Paperback)
  • All (10) from $1.99   
  • Used (10) from $1.99   
Sort by
Showing 11 – 10 of 0
We’re having technical difficulties. Please try again shortly.
Showing 11 – 10 of 0
Sort by
Sending request ...


Here's a concept -- writing hot computer programs that actually do useful things! VBA, the programming language built into numerous software applications from Microsoft Office to Visio and AutoCAD, is the ideal tool to personalize your VBA-enabled programs to suit your own home or office needs.

With VBA and a copy of VBA For Dummies, you can tweak the way your applications look and work with all the confidence of a master programmer...and without all the drudgery of typing endless lines of unintelligible code. Add buttons, check boxes, menu items, and custom dialog boxes with the VBA language's easy visual interface, or automate common everyday tasks (and some quite uncommon tasks, too). All the tips and tricks for writing clean, easy-to-read VBA code -- plus a bonus CD-ROM disc packed with source code, ActiveX control demos, and Web site design tools -- are right at your fingertips with VBA For Dummies, your best all-in-one reference to developing custom business applications.

Read More Show Less

Product Details

  • ISBN-13: 9780764502583
  • Publisher: Wiley, John & Sons, Incorporated
  • Publication date: 2/28/1998
  • Series: For Dummies Series
  • Edition description: Older Edition
  • Edition number: 1
  • Pages: 416
  • Product dimensions: 7.39 (w) x 9.25 (h) x 1.09 (d)

Table of Contents


What the Book Covers
I Shouldn't Make Any Assumptions...
Divide and Conquer
Part I: Don't Sweat the Technical Stuff -- And It's All Technical Stuff
Part II: VBA Boot Camp
Part III: Mastering the VBA Development Environment
Part IV: The Main Course
Part V: Designing Active Forms
Part VI: The Part of Tens
How to Use the Examples
What's on the CD-ROM
Icons Used in This Book
Part I: Don't Sweat the Technical Stuff -- And It's All Technical Stuff

Chapter 1: VBA for the Armchair Tourist

Why Bother with VBA?
VBA Is the Steering Wheel, but You Still Need the Car
Non-Microsoft VBA applications
The range of VBA applications
Programming with VBA
What's so visual about Visual Basic for Applications?
The main events
The programming cycle
More about What You Can Do with VBA
Customizing the user interface
Adding new features
Creating advanced custom programs
Not Your Mama's BASIC
The VBA integrated development environment
Macros and VBA
Controls -- ActiveX and otherwise
VBA is a standard -- sort of
VBA dialects
Why VBA is usually slower than Visual Basic

Chapter 2: Object-Oriented Programming with VBA

So What's an Object?
Objects as components of VBA applications
Objects conceptualized
A practical definition of objects
About properties
About methods
About events
Object classes versus specific objects
Collection objects
What's an Object Model?
Understanding why the object model is important
Extending the object model
VBA Forms Are Objects, Too
Forms in the object model
All about ActiveX controls
Part II: VBA Boot Camp

Chapter 3: Don't Program When You Can Record a Macro

Understanding How Macros Work
When to record macros
Macros feel good, but they lead to the hard stuff
Planning a Macro
Recording Macros
Starting the macro recorder
Naming the baby
Making other choices in the Record Macro dialog box
Button, button, who's got the button?
Starting the macro recorder
Recording commands
Stopping and pausing the macro recorder
Running macros
Modifying Macros -- The Easy Way to Write Code
Editing macro code in the Visual Basic Editor
Making easy macro modifications

Chapter 4: Basic VBA Programming

Starting the Visual Basic Editor
One-click access to the Visual Basic Editor
A peek into the Visual Basic Editor
I Need Help!
411 for VBA -- or is it 911?
Searching the Help haystack
Understanding what's special about VBA Help topics
Installing all the Help files...
Creating a VBA Program
Step 1: Designing the sample program
Step 2: Implementing the design
Adding a new UserForm
Adding a label control to the UserForm
Using the Properties window to tweak controls
Adding a command button
Writing the code
Opening the form's Code window
Adding your own code
Creating a second procedure
Writing code for the new procedure
Step 3: Testing your program
Running programs in the Visual Basic Editor
Running clinical trials
Step 4: Debugging
Returning to Your VBA Application

Chapter 5: Running VBA Programs

The Name Is Everything
Running from the Macro Dialog Box
Displaying the Macro dialog box
Running a macro
Finding your macro in the Macro dialog box
Launching Programs Quickly
Push button programs
Easy buttons in Office
Creating the button
Putting on a pretty face
Removing buttons
Custom buttons via VBA code
And they call VBA a standard...
A sample Visio procedure
Custom menu items for your VBA programs
Keyboard shortcuts in Word, Excel, and Access
Custom keyboard shortcuts in Word
Keyboard shortcuts in Excel
Keyboard shortcuts in Access
Mouse macros in Visio
Running VBA Programs Automatically
Part III: Mastering the VBA Development Environment

Chapter 6: The Visual Basic Editor at Your Command

Working with the Visual Basic Editor User Interface
Out to lunch with Editor menus
Tuning the toolbars
Customizing your toolbars and menus
Moving and deleting toolbar buttons
Adding new toolbar buttons
Monkeying with the menus
Keyboard shortcuts
Managing the Windows
Some windows are loners; some run in crowds
Viewing and hiding windows
Sittin' on the dock of the VB-ay
No docking
Docking factoids
Saving the screen layout

Chapter 7: Getting Things Done in the Visual Basic Editor

Managing Your Projects with Project Explorer
Opening the Project Explorer window
Exploring the Explorer
Navigating the Project Explorer window
Using the Project Explorer shortcut menu
Setting project properties
Renaming a project
Protecting your project
Using the Object Browser
Starting the Object Browser
Browsing objects
Browsing panes
Surfing the projects
Instantly accessing your code
Getting Help in the Object Browser
Searching for members
Using browsed items in your code
Coding Secrets
Opening Code windows
Creating new Code windows
Typing code
The ideal coach
Navigating in a Code window
Bookmarking your code
Splitting a Code window
More Code window creature comforts
Using the List Properties and Methods feature
Listing constants automatically
Completing words automatically
Getting into arguments
Using the Properties Window
Invoking the Properties window
Renaming a project or module in the Properties window
A First Look at the Debugging Windows
Part IV: The Main Course

Chapter 8: Anatomy of a Great VBA Program

Program Building Blocks
Programs defined
A sample program
The VBA hierarchy
Where Do Projects Come from, Mommy?
Totally Modular
Planning your modules
Adding a new module to a VBA project
What goes where in a new module
Standard modules and modules with class
Writing Procedures
Procedure skeletons
Creating a new procedure
Typing versus the dialog box
Completing the procedure
Procedure types
Sub procedures in detail
Items in a Sub procedure declaration
Forgoing arguments
Calling Sub procedures
Function procedures in detail
The difference between Function and Sub procedures
Calling Function procedures
Winning arguments
Productive arguments
So why argue?
Writing procedures that take arguments
Calling procedures that take arguments
Organizing your procedures
Scoping Out the Scope
Specifying a procedure's scope
Using private procedures
Making Your Statements
Assignment statements
Executable statements
Compiler options
Multiple-line statements and multiple-statement lines

Chapter 9: Manners, Please! VBA Etiquette

Naming Your Babies
How VBA handles capitalization
VBA naming conventions
Making Your Code Pretty
Judicious indenting helps organize your code
Indenting customs
How to indent
Automatic indenting
Space-iousness is good
Don't scroll if you don't have to!
Using the line continuation character
Not using multiple-line statements
Remarks about Comments
When to use comments
Long-winded comments
REM sleep for your comments

Chapter 10: Storing and Modifying Information

Working with Variables
Declaring variables: The overview
Where to declare variables
Choosing and using data types
Explicit declarations are good...
...So force yourself to use them
Specifying a variable's scope
Private, but nothing special
Public knowledge
The Static advantage
Declaring multiple variables on the same line
Giving variables their values
Using variables in assignment statements
Using functions in assignment statements
Working with Values Constant-ly
Declaring constants
Reaping the benefits of a constant approach
Using constants to represent attributes
Hello, Operators
Taking precedence
Performing calculations with arithmetic operators
Comparing values
Comparing strings
Comparing strings of unequal length
What's not to Like?
Using comparison operators in code
Stringing text together
Details on Data Types
Converting between data types
Understanding Variants
Choosing a numeric data type
Discovering when to use Boolean variables
Working with currency values
Working with dates
Entering date values
The value of time
Date and time math
Stringing you along
More about string declarations
Fixing your strings

Chapter 11: Objectivity

Using Objects in Code: An Introduction
Getting and Changing Object Properties
What you can't do with some properties
Property settings are data
Retrieving a property's current setting
Changing a property's setting
Default properties
Objects as properties
Climbing the family tree
Method Acting
Identifying the Object You Want to Work With
Understanding object expressions
Working with properties that are objects
Getting objects
Working with Collection objects
Creating object variables
Declaring an object variable
Assigning an object reference to a variable
Emptying an object variable
Creating new objects
Using the Add method
Creating a variable for an object you create
Creating objects with New and CreateObject
Efficient coding with objects
Comparing object references

Chapter 12: The Instruments in the Built-In Orchestra

Finding Built-In Commands
Formatting Data
Using the Format function in code
Specifying prefab and custom formats
Using the IIf function
Converting Data
Working with hex and octal values
Converting between numbers and strings
Con Text
Removing characters at the end of a string with Len and Left
Extracting characters from within a string
Working with Dates and Times
A date with time
Calculating with dates
Adding to and subtracting from dates and times
Calculating the difference between two dates
Simple Interactions with the World
Displaying message boxes
Specifying the prompt
Creating fancier message boxes
Calculating a value for the buttons argument
Who's got the button?
Adding a title
Obtaining user input
Fun with Math and Money
Math functions
Deriving other math functions
Working with random numbers
Financial functions
Calculating payments on a loan or savings plan
Putting bread and butter on the table
Miscellaneous Built-In Commands

Chapter 13: Controlling the Flow

Controlling Wild Programs with Control Structures
Control structure anatomy
Nested control structures
Use indents!
The road taken: Using condition expressions
How condition expressions work
Condition expressions without comparison operators
Using logical operators in conditions
Using If...Then Statements
The basic form: If...Then
One-liners with If...Then
If...Then...Else statements
If...Then complexities: The introduction
Complexities, Part I: Using If...ElseIf statements
Complexities, Part II: Nesting If...Then statements
Complexities, Part III: Using logical operators in conditions
Using Select Case Statements
Testing conditions in Select Case statements
A sample Select Case statement
The Case Else clause
More about Case clause tests...a lot more
Repeating Yourself with Loops
Do-ing loops
Types of Do...Loop statements
The Do While...Loop statement
A Do While...Loop example (two examples, actually)
The example explained
Other Do statements
Do...Loop While
Do Until loops
To Do or not to Do
When to use Do without While or Until
Repeating on count with For...Next loops
Important tips about For...Next loops
For...Next loops and arrays
Nested For...Next loops
Get out now with an Exit For
Custom steps
For Each...Next
For Each...Next in action
Hasty escapes from For Each...Next
Performing Multiple Machinations on One Object
About object references and the benefits of With
Finally, the example With
With with user-defined data types
Interrupting the Flow with GoTo
A GoTo example
GoTo caveats

Chapter 14: Advanced Data Storage: Arrays and User-Defined Data Types

Seeing A-rray of Hope
Referring to the items in an array
Understanding array data
Using arrays of multiple dimensions
Declaring arrays
Understanding array element numbering
Declaring fixed arrays
Declaring dynamic arrays
ReDim-ming dynamic arrays
Preserving data when resizing an array
Addressing elements in an array
Using array elements in code
Using variables in an array index
Assigning data to an array...in bulk
Defining Your Own Data Types
Understanding user-defined data types
Declaring a user-defined data type
Declaring variables of a user-defined type
Working with information in a user-defined type
Working with variables of user-defined type as a whole
Managing Sets of Data with Collection Objects
Weighing the trade-offs in using collections
Creating Collection objects
Adding data to a collection
Assigning keys to items
Adding an item at a specific location
Adding multiple items efficiently
Removing items
Count-ing your collection
Accessing items in a collection
Using collections for database-type data

Chapter 15: Unbreakable Code: Debugging and Error Trapping

What Can Go Wrong Does Go Wrong
Fixing Syntax Errors
Entomology for VBA Programmers
Test, test, test
Take a break
Entering break mode
Setting breakpoints
Clearing breakpoints
Knowing where you are in break mode
Using a breakpoint alternative: The Stop statement
Getting out of break mode
Steppin' through code
I Stepped Into it this time
Stepping Over and out
Major manipulations during debugging
Adding and editing code in break mode
Choosing a different next statement
Seeing Data Tips
Immediate Gratifications
Local mechanics
Why edit variable values?
How to edit variable values
The Watch Window: Key Debugging Tool
Adding watch expressions
Working with the Add Watch window
Editing watch expressions
Using watch expressions to define breakpoints
Trapping Wild Bugs with On Error and the Error Object
Where run-time errors come from
How error-handling code works
How to write error-handling code
Writing On Error statements
Adding an Exit statement to the procedure
Writing the error handler
Adding a label
Getting information about and dealing with the error
Resuming program execution
Part V: Designing Active Forms

Chapter 16: Laying Out VBA Forms

Getting Started with Form Design
Running forms
Forms and controls as objects
Limitations of VBA forms
Planning forms for your program
Budgeting for your form-programming needs
Printing forms during the design process
Laying Out a New Form
Creating the form
Adding controls from the Toolbox
Working with Form and Control Properties
Touring the Properties window
Getting Help on properties
Changing property settings
Don't forget to select the right item
Working with Key Form and Control Properties
The Name is not the Caption
Sizing and positioning forms and controls
Sizing forms with the mouse
Sizing by the numbers
Controlling a form's position on-screen
Positioning controls
Choosing colors
Selecting fonts
Trés chic with special 3-D effects
Easy mouse tricks
Customizing the mouse pointer
Using mouse pointers of your own design
Adding ToolTips to controls
Adding a picture to a form or control
Removing a picture using the Properties window
Editing Controls: The Basics
Cutting, copying, and pasting controls
Deleting controls
Selecting multiple controls
Undoing changes
Working with the grid
Setting grid options
Formatting Controls
Using the Format menu
Using the UserForm toolbar
Grouping multiple controls
Arranging controls on top of one another
Formatting multiple controls
Control and domination
Aligning controls
Making controls the same size
Adjusting horizontal and vertical spacing
Making other formatting choices
Part VI: The Part of Tens

Chapter 17: Ten (Minus Five) Really Cool Things You Can Do with VBA

Working with Disk Files
Understanding how VBA handles files
Opening disk files
Choosing a file access mode
Not playing the numbers game
Closing the files you open
Reading and writing data
Storing Stuff in the Windows Registry
Exposing Themselves (Accessing the Objects of Other Applications)
Understanding the basics of cross-application programming
Adding a reference to the foreign object model
Declaring external objects
Creating the external object
Using the external objects
Do-It-Yourself Objects
Creating class modules
Understanding the components of a class definition
Declaring class variables
Writing property procedures
Setting object properties with Property Let procedures
Retrieving object properties with Property Get procedures
Writing methods
Using your custom objects
Adding ActiveX Controls
Adding new controls to the Toolbox
Registering a control
Putting the tool in your Toolbox
Using ActiveX controls in your programs

Chapter 18: Ten (Times Three) VBA Resources

Your First Stop for More VBA Info
Steal that source code
Look at what's available from Microsoft
Magazines and Newsletters
Public VBA Web Sites
A Galaxy of ActiveX Controls
Tool mania
Picturesque programming
Charts a la carte
Word processing controls and spreadsheet grids
De-basing yourself in style
Hello, operator
Take the money and run
Design your own controls
Miscellaneous Stuff
Industrial strength calculations
Help, help!
Appendix: About the CD

System Requirements
How to Use the CD
What You'll Find
VBA For Dummies source code
ActiveX Component Suite, from ProtoView Development Corp.
EdgeWorX, from Vectrix Corporation
Visual CGI, from Quasit Technologies, Inc.
Visual Voice Pro 4.0, from Artisoft, Inc.
Bonus! Additional Chapters
Adobe Acrobat Reader
If You Have Problems (Of the CD Kind)

License Agreement

Installation Instructions

Book Registration Information

Read More Show Less

Customer Reviews

Average Rating 4
( 1 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted June 26, 2000

    Very helpful

    I had done some programming in the past, but had only limited experience with VB, and no experience with VBA. I wanted to make my Access databases more powerful. I understood the concepts of Loops and Conditional Statements, but wasn't sure how to phrase them in VBA. This book showed me how. And, it got me up-to-speed quickly.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)