General discussion

Locked

Excel 97 VBA

By paul ·
I have a number of excel 97 workbooks that call VB macros from a different workbook. I need a way to run those macros, preferred way would be to load a toolbar with the workbook (but only for that workbook) - is it possible? How?

This conversation is currently closed to new comments.

6 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Excel 97 VBA

by Oliver W. In reply to Excel 97 VBA

insert all those makros in a seperate workbook and save this as an excel add in.
When this add in is activated (Excel Add In Manager) every workbook references to this add in.
Now insert a routine for the toolbar into this addin.
Call this routine only from the workbooks you want to.

hope that helps.

Collapse -

Excel 97 VBA

by paul In reply to Excel 97 VBA
Collapse -

Excel 97 VBA

by mcorr In reply to Excel 97 VBA

Sure it is possible. I will try to make this generic for both 97 and 2000 since you didn't specify.

Basically the idea is:
1. Create your macro.
2. Create your toolbar (View->Toolbars->Customize) and make sure it is saved in your spreadsheetby clicking the attach button and copying the macro over to your spreadsheet.
3. Add a button for your macro - use Custom Button on commands tab, then change the macro by right clicking on the new button.
4. In the Workbook_Open event for your spreadsheet (alt-f11), add the code below, Where toolbar1 is the name of your toolbar.

Application.CommandBars("toolbar1").Visible = True

If you have the macro protection enabled, this will cause the macro warning message to be displayed.

Hope this helps -Chris

Collapse -

Excel 97 VBA

by paul In reply to Excel 97 VBA
Collapse -

Excel 97 VBA

by tclere In reply to Excel 97 VBA

WARNING! If you want to create an add-in, as proposed in Solution 1, you better create a backup copy of the file first. When you compile the workbook as an add-in, it overwrites your original file. There is no way to go back to an uncompiled versionwithout manually backing up the original workbook. Add-ins are nice because they can hold all of your functions. Then, if you want another workbook to use any of these functions, you only need to include the add-in.

Collapse -

Excel 97 VBA

by paul In reply to Excel 97 VBA
Back to Web Development Forum
6 total posts (Page 1 of 1)  

Related Discussions

Related Forums