Macro to open file

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 09:46 PM GMT

Question

I want to put a macro button on my toolbar to open a certain file no matter what worksheet I am in. Does it have to do with where I save the macro? I cant get it to work. Thank you!

Answer

Hello Lynn, you didn't ask me this question, but whomever you did ask, for whatever reason, placed it in the question pool for others to answer.

Macros must be stored in a workbook. has provided a workbook named Personal.xls for this purpose. There is really nothing special about Personal.xls except that it is stored in the startup folder, it is hidden by default and it is opened everytimeis opened. If you don't already have a personal.xls workbook, you can create one by recording a macro. go to tools=>macro=>record a macro and select personal workbook. then click a cell or two on the worksheet and click the stop recording button. this will create your personal.xls. You can go to the visual basic editor and you should see it in the Project manager.

If you select this workbook in the project manager and expand the module leaf, you should have at least one module (module1) with the macro you recorded.

You can remove that macro if you want.

then put in the the code you want executed when your button is pushed.

Now exit excel. You should be prompted to save changes to the personal workbook. Click yes.

Now reopenand go to your toolbar. (I assume you know how to get into design mode for toolbars and so forth since you say you have been doing that). Assign the macro in your personal.xls to the commandbutton.

If you need any other information on this or this answer is not clear, then just post a followup to this question with your concerns or where you need additional information.

Hopefully that answers the question and you are on your way.

Advertisement

©2020 eLuminary LLC. All rights reserved.