Show Contents / Index / Search

Guidelines for Command Syntax

Every keyword Help topic includes a syntax line that defines the syntax rules for that keyword. Following are some guidelines for understanding and using correct command syntax in your Visual Basic macros:

  • Keywords and arguments are not case sensitive. You can use uppercase or lowercase text.
  • Use square brackets ([ ]) to indicate that an argument is optional.
  • Use items shown in command language (that is, plain text — not italic) exactly as they appear in the syntax statement.
  • Italic words indicate placeholders for variable names, text, or values that you should supply.
  • Use arguments (except for named arguments) in the order shown in the syntax statement.
  • Enclose literal string arguments in quotation marks. (String variables don't require quotation marks.)
  • For strings that appear within other strings, use double quotation marks; for example:

    ThisScreen.SomeMethod ("Say ""Hello"" to Jon")

  • Precede Reflection methods or properties with the Reflection object and a period. Or, use a With statement to identify the object.

 

Example

The following two examples demonstrate different forms of syntax (using the SendKeys command), each of which achieve the same results:

This syntax example

Demonstrates

ThisScreen.SendKeys

Preceding the command with a Reflection object.

With ThisScreen

.SendKeys

End With

Placing the command between With and End With statements.

Related Topics

Named Arguments