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
 

Some videos you may like

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Datsmart

Well-known Member
Joined
Jun 19, 2003
Messages
7,985
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).
 

farnuckl

Board Regular
Joined
Dec 16, 2003
Messages
127
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
 

Datsmart

Well-known Member
Joined
Jun 19, 2003
Messages
7,985
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.
 

Greg Truby

MrExcel MVP
Joined
Jun 19, 2002
Messages
10,014

ADVERTISEMENT

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.
 

Greg Truby

MrExcel MVP
Joined
Jun 19, 2002
Messages
10,014
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.)
 

farnuckl

Board Regular
Joined
Dec 16, 2003
Messages
127
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
 

Greg Truby

MrExcel MVP
Joined
Jun 19, 2002
Messages
10,014
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,234
Messages
5,571,045
Members
412,359
Latest member
misstoffeepenny
Top