General discussion

  • Creator
  • #2073666

    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?

All Comments

  • Author
    • #3894767

      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.

    • #3893701

      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

    • #3893621

      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.

Viewing 2 reply threads