XL97: Macro Error When You Use GET.TOOLBAR Command (171309)



The information in this article applies to:

  • Microsoft Excel 97 for Windows

This article was previously published under Q171309

SYMPTOMS

In Microsoft Excel 97, when you run a macro written in the Microsoft Excel Macro language (XLM), you may receive an error message similar to the following:
Macro error at cell:
[Book3]Macro1!A10
The same macro works correctly in earlier versions of Microsoft Excel.

CAUSE

This problem occurs if the XLM macro contains a line of code that uses the GET.TOOLBAR command with a type_num argument of 1, for example:
   =GET.TOOLBAR(1,"Standard")
				

RESOLUTION

To correct this problem, install Microsoft Excel 97 Service Release 1 (SR-1).

STATUS

Microsoft has confirmed this to be a problem in Microsoft Excel 97. This problem was corrected in Microsoft Excel 97 SR-1.

For additional information about SR-1, please see the following article in the Microsoft Knowledge Base:

172475 OFF97: How to Obtain and Install MS Office 97 SR-1

MORE INFORMATION

In an XLM macro, you can use the GET.TOOLBAR command to return information about a single toolbar or all toolbars. If you use a type_num argument of 1, the GET.TOOLBAR command returns a horizontal array of all tool IDs on the specified toolbar ordered by position. For example, to display all of the IDs for tools on the Standard toolbar, use XLM code similar to the following:
   =SET.NAME("ToolArray",GET.TOOLBAR(1,"Standard"))
   =FOR("x",1,COLUMNS(ToolArray))
   =ALERT(INDEX(ToolArray,1,x))
   =NEXT()
   =RETURN()
				
NOTE: The SET.NAME command is entered as an array formula. To do this, press CTRL+SHIFT+ENTER.

This code does not work correctly in Microsoft Excel 97 because the GET.TOOLBAR command fails with a type_num of 1. However, the code works correctly in Microsoft Excel 97 SR-1.

Modification Type:MajorLast Reviewed:10/21/2000
Keywords:kbbug kberrmsg KB171309