SaveAs without code button

farnuckl

Board Regular
Joined
Dec 16, 2003
Messages
127
Hello, I would like to create a button on my menu that will "save as" a workbook without the code attached. I already have code that will do it, I just need a jumpstart in the right direction to get the button set up.
The way I would do it now would be to make a macro button that would open a new book and run the code from there, but I think there is a smoother way than that...

Thanks,
-farnuckl
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
I am assuming you want to put a button on a toolbar, if so here are the steps:

Right mouse over a toolbar and select customize, select the Commands tab, in categories select Macros, click and drag the Custom button onto your toolbar, then right mouse over it and select Assign Macro. (you can also change the icon and name).
 
Upvote 0
farnuckl said:
The way I would do it now would be to make a macro button that would open a new book and run the code from there, but I think there is a smoother way than that...

Thanks,
-farnuckl


Thanks Datsmart, but I know how to do that, it just seems clumsy to have to open a workbook just to run some code from it. I'm self taught, so I don't know some of the slick ways of doing things...

-farnuckl
 
Upvote 0
Still not quite sure what you want to do.
If you just want to run some code without having to open a workbook that it is in, put the code in "Personal.xls". Assign it to a Button on a toolbar. Then you can run it any time you want.
 
Upvote 0
The simplest answer is to just pop the code into your Personal Macro workbook. Then the code is already open and ready to go for the button. Otherwise, yes, Excel will go out and fetch the workbook containing the code tied to the menu/command button.
 
Upvote 0
My boilerplate on the subject...
<hr>If you wish to always have the macro available and not just when one particular workbook is open - i.e. the macro is a "generic" macro; it is better to place the macro in your Personal Macro Workbook. This is a workbook that Excel automatically creates. If you use the Macro Recorder to record a macro, the dialog box asks where you want to store the macro: (a) the active wb, (b) a new wb or (c) in your Personal Macro wb. If you select Personal Macro Workbook and you have not previously recorded a macro there, Excel will create it for you, naming it Personal.xls and placing it in your Excel startup directory. This way every time you start Excel, Personal.xls will load and its macros will be available to you. (Note that Personal.xls is a hidden workbook and not an Excel Add-In.)
 
Upvote 0
Ok, cool, now we're talking. Does this workbook have to be in a particular path?

[edit]
Ok, thanks Greg, we must have posted at the same time there.
[edit]

-farnuckl
 
Upvote 0
Excel will put it in your startup directory. Normally that's going to be:

C:\Documents and Settings\username\Application Data\Microsoft\Excel\XLSTART\

Note that \Application Data\ is a hidden directory and won't show unless you have configured WinExplorer to show hidden folders.
 
Upvote 0

Forum statistics

Threads
1,213,561
Messages
6,114,316
Members
448,564
Latest member
ED38

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top