Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Using VBA macros in all workbooks

I've created a VBA macro for Excel which does some formatting of a
spreadsheet I receive weekly at work, and saves a lot of time.
However, I want to be able to just use the macro of the spreadsheet
when it is mailed to me. I though of having the macro in a blank
spreadsheet in the background while opening the new spreasheet (this
is my current solution) but, to be honest, this seems like a bit of a
botched solution! Surely there is some way to just load a macro and
run it - I want this to be as simple as possible so I can instruction
other non-macro-savvy workmates to use the macro in my abscense.

Any ideas?

Cheers,
Ian Griffiths.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Using VBA macros in all workbooks

Ian,

Seems best to put the macros in an addin. You could also have the addin
create a commandbar top launch the macros.

--

HTH

Bob Phillips

"Ian Griffiths" wrote in message
om...
I've created a VBA macro for Excel which does some formatting of a
spreadsheet I receive weekly at work, and saves a lot of time.
However, I want to be able to just use the macro of the spreadsheet
when it is mailed to me. I though of having the macro in a blank
spreadsheet in the background while opening the new spreasheet (this
is my current solution) but, to be honest, this seems like a bit of a
botched solution! Surely there is some way to just load a macro and
run it - I want this to be as simple as possible so I can instruction
other non-macro-savvy workmates to use the macro in my abscense.

Any ideas?

Cheers,
Ian Griffiths.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Using VBA macros in all workbooks

Excel opens a blank workbook every time you start it, but it is hidden. The
name of the workbook is personal.xls and it can contain all of the "global"
macros that you write and want to use in any workbook that you open. I have
a few formatting macros in my personal macro folder.

Open the file that contains the macro, select ToolsMacroMacros and select
Edit.
You should see your macro in the right hand window (Code Window).
Highlight the macro from "Sub Macro1()" to "End Sub" and copy. (if you
called it something other than Macro1, highlight that)
In the left window, there should be a Project Explorer window with a caption
"Project-VBAProject" and a tree of filenames with branches of worksheets and
modules. If you don't see that, press ctrl-R to open the Project Explorer
Window.
One project should be named "Personal". If it is not expanded, click the +
to expand the tree and click on Module1 to open it in the Code Window to the
right. If there is no module, right click the Project explorer window and
select InsertModule.

Paste your Macro into the code window with Personal.Module1 open.

You can attach some bells and whistles, like a menu button or hot key to run
the macro. Give a holler if you need help.

When you close Excel, a warning will advise you that there have been changes
made to the personal macro folder, do you want to save the changes? Click
Yes. The macro will be available whenever you open Excel.

Making it an addin would work, but, like the blank worksheet or template, it
is a bit of overkill.
Any coworkers that need to use the macro will have to repeat the above steps
with their own personal macro folder.


"Ian Griffiths" wrote in message
om...
I've created a VBA macro for Excel which does some formatting of a
spreadsheet I receive weekly at work, and saves a lot of time.
However, I want to be able to just use the macro of the spreadsheet
when it is mailed to me. I though of having the macro in a blank
spreadsheet in the background while opening the new spreasheet (this
is my current solution) but, to be honest, this seems like a bit of a
botched solution! Surely there is some way to just load a macro and
run it - I want this to be as simple as possible so I can instruction
other non-macro-savvy workmates to use the macro in my abscense.

Any ideas?

Cheers,
Ian Griffiths.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Using VBA macros in all workbooks

Excel doesn't create the personal.xls until the user records a macro and
says to store it there. So it doesn't automatically exist. Also, any
workbook stored in the xlstart (startup) directory will be opened by excel
when it is opened manually with no suppression options. Any workbook could
be stored there as hidden and would provide similar functionality in terms
of the availability of macros.

--
Regards,
Tom Ogilvy

Bradley Dawson wrote in message
...
Excel opens a blank workbook every time you start it, but it is hidden.

The
name of the workbook is personal.xls and it can contain all of the

"global"
macros that you write and want to use in any workbook that you open. I

have
a few formatting macros in my personal macro folder.

Open the file that contains the macro, select ToolsMacroMacros and

select
Edit.
You should see your macro in the right hand window (Code Window).
Highlight the macro from "Sub Macro1()" to "End Sub" and copy. (if you
called it something other than Macro1, highlight that)
In the left window, there should be a Project Explorer window with a

caption
"Project-VBAProject" and a tree of filenames with branches of worksheets

and
modules. If you don't see that, press ctrl-R to open the Project Explorer
Window.
One project should be named "Personal". If it is not expanded, click the

+
to expand the tree and click on Module1 to open it in the Code Window to

the
right. If there is no module, right click the Project explorer window and
select InsertModule.

Paste your Macro into the code window with Personal.Module1 open.

You can attach some bells and whistles, like a menu button or hot key to

run
the macro. Give a holler if you need help.

When you close Excel, a warning will advise you that there have been

changes
made to the personal macro folder, do you want to save the changes? Click
Yes. The macro will be available whenever you open Excel.

Making it an addin would work, but, like the blank worksheet or template,

it
is a bit of overkill.
Any coworkers that need to use the macro will have to repeat the above

steps
with their own personal macro folder.


"Ian Griffiths" wrote in message
om...
I've created a VBA macro for Excel which does some formatting of a
spreadsheet I receive weekly at work, and saves a lot of time.
However, I want to be able to just use the macro of the spreadsheet
when it is mailed to me. I though of having the macro in a blank
spreadsheet in the background while opening the new spreasheet (this
is my current solution) but, to be honest, this seems like a bit of a
botched solution! Surely there is some way to just load a macro and
run it - I want this to be as simple as possible so I can instruction
other non-macro-savvy workmates to use the macro in my abscense.

Any ideas?

Cheers,
Ian Griffiths.





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Using VBA macros in all workbooks


"Tom Ogilvy" wrote in message
...
Excel doesn't create the personal.xls until the user records a macro and
says to store it there. So it doesn't automatically exist. Also, any
workbook stored in the xlstart (startup) directory will be opened by excel
when it is opened manually with no suppression options. Any workbook

could
be stored there as hidden and would provide similar functionality in terms
of the availability of macros.

--
Regards,
Tom Ogilvy


Do you think it would be better to place the workbook with the macro in the
xlstart directory, record a dummy macro like copy a1 paste a2 to create
personal.xls or do the addin as the others suggested?




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Using VBA macros in all workbooks

for a single Utility type macro, being distributed to others, I would
probably use a workbook stored in the xlstart directory other than
personal.xls or if the users are VBA literate, send them the source code in
an email and let them paste it where they want. I see personal.xls as being
just that. Sharing personal.xls doesn't really appeal to me. For more
stringent requirements, an addin is probably advisable - but not if you want
to do Tools=Macros=Macro to run it.

It is really situationally dependent.

--
Regards,
Tom Ogilvy

Bradley Dawson wrote in message
...

"Tom Ogilvy" wrote in message
...
Excel doesn't create the personal.xls until the user records a macro and
says to store it there. So it doesn't automatically exist. Also, any
workbook stored in the xlstart (startup) directory will be opened by

excel
when it is opened manually with no suppression options. Any workbook

could
be stored there as hidden and would provide similar functionality in

terms
of the availability of macros.

--
Regards,
Tom Ogilvy


Do you think it would be better to place the workbook with the macro in

the
xlstart directory, record a dummy macro like copy a1 paste a2 to create
personal.xls or do the addin as the others suggested?




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Using VBA macros in all workbooks

This is all very helpful guys, I'm going to try and create the
personal.xls tomorrow if I can, but keep the suggestions coming!

Cheers,
Ian.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macros in shared workbooks Very Basic User Excel Discussion (Misc queries) 4 September 14th 09 08:20 PM
Macros common to several workbooks Jayen Excel Worksheet Functions 2 October 31st 08 02:22 PM
Cascading macros to new workbooks Phil N Dank Excel Worksheet Functions 3 November 13th 06 04:45 PM
Making Macros Available in All Workbooks QUESTION-MARK Excel Worksheet Functions 2 May 23rd 06 01:47 PM
linking of macros with other workbooks. need to stop it! KyWilde Excel Discussion (Misc queries) 1 March 10th 05 07:13 PM


All times are GMT +1. The time now is 01:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"