Microsoft KB Archive/193427

= XL98: How to Use a Toolbar Button to Open a File Indirectly =

Article ID: 193427

Article Last Modified on 9/11/2002

-

APPLIES TO


 * Microsoft Excel 98 for Macintosh

-



This article was previously published under Q193427





SUMMARY
In Microsoft Excel 98 Macintosh Edition, you can indirectly associate a workbook with a custom button in another workbook by assigning a macro in the associated workbook to the button.

For example, if you have a workbook named "My Workbook" that contains a button, you can indirectly associate a second workbook called "Main Workbook" with that button by assigning a Microsoft Visual Basic for Applications module in "Main Workbook" to the button. When you click the button in "My Workbook," the second workbook, "Main Workbook," is opened automatically.



MORE INFORMATION
To associate a workbook with a custom button, do the following:

 In Microsoft Excel, create a new workbook. Press OPTION+F11 to activate the Visual Basic Editor. (Or, click the Tools menu, point to Macro, and then click Visual Basic Editor.)  Click Module on the Insert menu. In the Code window, type the following code: Sub Test End Sub  Click Close and Return to Microsoft Excel on the File menu to return to the workbook. On the View menu, point to Toolbars and click Customize. Click the Command tab in the Toolbars dialog box. Select Macros in the Categories list box.</li> Drag the Custom Button over a toolbar and release the mouse button.</li> Click Modify Selection in the Customize dialog box, and then click Assign Macro on the menu that appears. Click Test Macro name listbox, and then click OK.

This will assign the macro Test to the custom button.</li> In the Customize dialog box, click Close.</li> On the File menu, click Save.</li> On the File menu, Click Close.</li></ol>

When you click the custom button, your file is opened; because the sample macro has no commands, it runs without performing any actions.

Additional query words: XL98

Keywords: kbhowto KB193427

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.