PRJ: Cannot Execute Macros with Optional Arguments

ID: Q124369


The information in this article applies to:
  • Microsoft Project for Windows, version 4.0
  • Microsoft Project for the Macintosh, version 4.0


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:

  • When you attempt to run the macro by choosing a toolbar button, Microsoft Project displays the following error message:
    Cannot find the macro 'macroname'


  • You are unable to run the macro when you choose the Run button in the Macros dialog box.



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: BugList4.00

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


Last Reviewed: October 19, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.