On a computer that has an x64-based Windows Vista or Windows Server 2008 system installed, when you call the VarFormat function by using a format string that contains a period character (.), and this “.” character does not represent a decimal separator, the VarFormat function may be unsuccessful. Instead, the VarFormat function returns an “E_INVALIDARG” value, which means “One or more of the arguments is invalid.”

Note The VarFormat function formats a variant into a string form by parsing a format string. See the “More information” section for more information.

Functions that depend on the VarFormat function may also experience the failure in this same scenario. For example, the following user-defined function uses a “.” character in a VBA Format function, and this format eventually calls the VarFormat function. You also receive an “Invalid procedure call or argument” Microsoft Visual Basic Run-time error message when you run the following user-defined function in Microsoft Office Excel:

Sub foo()
Dim VarTmp as Variant
VarTmp = Format(NULL, “#;(#);;n.a.”)
MsgBox VarTmp
End Sub

Leave a Reply