XL98: Run-time Error 5 Using Example MacScript Code (186110)



The information in this article applies to:

  • Microsoft Excel 98 Macintosh Edition

This article was previously published under Q186110

SYMPTOMS

When you use the example macro code provided in the MacScript Function Help topic, you may receive the following error:
Run-time error '5'
Invalid procedure call or argument

CAUSE

You receive this error because the example macro code is incorrect.

RESOLUTION

The example macro code provided in the MacScript Function Help topic is as follows:
   ThePath$ = Macscript("ChooseFile")
				
In order to get this example code to run successfully, change it as follows:
   ThePath$ = Macscript("Choose File")
				
Note that the only difference is the space between "Choose" and "File."

When you run your macro with this change, the Choose File script will return the name of the selected item to the variable called ThePath$ as a string.

STATUS

Microsoft has confirmed this to be a problem in Microsoft Excel 98 Macintosh Edition.

MORE INFORMATION

The example macro code included with the MacScript Function Help topic incorrectly references a script called ChooseFile. The correct name for this script is Choose File and is located in the <hard drive name>:System Folder:Scripting Additions folder. The scripts included in this folder are installed by your Apple Macintosh System software.

The third-party products discussed here are manufactured by vendors independent of Microsoft; we make no warranty, implied or otherwise, regarding these products' performance or reliability.

REFERENCES

For more information about the MacScript Function, click the Office Assistant, type "macscript," click Search, and then click to view "MacScript Function."

NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If Microsoft Help is not installed on your computer, please see the following article in the Microsoft Knowledge Base:

179216 OFF98: How to Use the Microsoft Office Installer Program


Modification Type:MajorLast Reviewed:9/11/2002
Keywords:kbbug kbdocerr KB186110