5.9. Arguments

An argument is a piece of information — supplied by a constant, a variable, a literal, or an expression — that you pass to a procedure, a function, or a method. Some arguments are required; others are optional. As you saw earlier, the following statement uses the optional argument SaveChanges to specify whether Word should save any unsaved changes while closing the active document:

ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges

This optional argument uses the built-in constant wdDoNotSaveChanges.

Understanding Literals

A literal can be used instead of a constant or variable, if you wish. With a literal, you just type in the actual value into the argument. For example, you can display a message box that says "Hi there!" ...

Get Mastering VBA for Microsoft Office 2007, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.