Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running macros in Excel.

Status
Not open for further replies.

cwalshe

Programmer
May 28, 2001
84
IE
Hi,

I wish to run a macro in Excel. I have added a new menu to the toolbar that references the macro. However when I click this option, the macro is called but a new instance of Excel is opened (i.e. that instance of Excel that the macro was saved to orginally).

I don't want this is happen. I would like the macro to run as if the code was in the open Excel app. I would also ratehr avoid templates.

Any ideas. This problem does not occur with Word or Powerpoint.

Thx,

Cormac
 
The best place for macros and user functions that you want to have always available is the Personal.xls file. This file is just a normal XL file except that normally it is invisible and only contains code. Just create a new workbook, save it as Personal.xls, but make sure that it is stored in the XLStart folder, so that it will always be loaded automatically. With this file as the acive workbook, goto the Window menu and select Hide. The book should now be invisible. When you exit Excel select Yes when asked to save changes to Personal.xls

In future should you record a macro you can select Persoanl Macro book (in the drop down list) as the book in which to store it, and it will then be avialbale when required.

As for your existing macros, you can just copy from the workbooks in which thwy are located to teh Personal.xls. You can do that via the VBA editor's Project Explorer. Just tdrag the module from the existing book to the Personal.xls project.

AC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top