PRJ: Cannot Execute Macros with Optional Arguments

ID: Q124369

The information in this article applies to:

SYMPTOMS

If a Visual Basic, Applications Edition, sub procedure in Microsoft Project is defined with only optional arguments, it will appear in the list of available macros. If you attempt to run the macro, the following will occur:

WORKAROUND

To keep the procedure from appearing in the list of available macros, use the Private keyword when you declare it. For example, the following procedure appears in the macro list:

   Sub OptTest(Optional dummy As Variant)

If you declare the macro as Private, as in the following example, it will not appear in the macro list:

   Private Sub OptTest(Optional dummy As Variant)

STATUS

Microsoft has confirmed this to be a problem in the products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

In general, only sub procedures with no defined arguments appear in the list of available Microsoft Project macros. However, if a sub procedure is defined with only optional arguments, it will be displayed in the list of available macros.

Additional query words: 4.00

Keywords          : kbcode kbprg
Version           : 4.0
Platform          : MACINTOSH WINDOWS
Issue type        : kbprb

Last Reviewed: November 25, 1997