Table of contents
TOC
Collapse the table of content
Expand the table of content

Named arguments not allowed

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Named arguments aren't permitted in all situations. This error has the following causes and solutions:

  • You tried to specify a named argument as an array index, for example:

    MyVar = MyArray(MyNamedArg := 1) 
    
Use an ordinary [variable](vbe-glossary.md) or constant[expression](vbe-glossary.md) as an array index.
  • You tried to specify a named argument with an object, for example:

    MyVar = MyObject(MyNamedArg := 1) 
    
 Use a variable or constant expression if the object requires an[argument](vbe-glossary.md). For example, if the default for an object is a [method](vbe-glossary.md), the object's name represents the default method. If it needs arguments, specify them positionally.
  • You tried to specify a named argument with an external name:

    MyVar = [MyName](MyNamedArg := 1) 
    
 Use an ordinary variable or constant expression if the external name needs an argument.
  • You tried to specify a named argument with a data member of an object, for example:

    MyVar = [MyObject].MyProperty(MyNamedArg := 1) 
    
 Use an ordinary variable or constant expression if the data member needs an argument.

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

© 2018 Microsoft