Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Run macro for all documents

Hi,

I have to add a custom footer to every excel document based on an
enviromental variable. This isn't a problem I've got the vb/vba code
to do this. My problem is that I'm not really sure where to put it.

No matter what the document is or what template it is based on I need
to run this code. I was wondering if I should put it in Excel10.xlb or
is there somewhere else that is always checked for code?

If I put it in Excel10.xlb will I also need to put it in any existing
templates that are used?

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Run macro for all documents


Blackstar wrote:
Hi,

I have to add a custom footer to every excel document based on an
enviromental variable. This isn't a problem I've got the vb/vba code
to do this. My problem is that I'm not really sure where to put it.

No matter what the document is or what template it is based on I need
to run this code. I was wondering if I should put it in Excel10.xlb or
is there somewhere else that is always checked for code?

If I put it in Excel10.xlb will I also need to put it in any existing
templates that are used?

Thanks


Edit the code must be run on save so it has to be in the ThisWorkbook
(Wookbook_BeforeSave) Method. So unfortunetly I don't beleive that
using personal.xls will work as this only seems to work for macros
rather than vba.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Run macro for all documents

If you need this code to run when any file is printed/opened/saved, you will
to look into Application Level events.
http://www.cpearson.com/excel/AppEvent.htm

NickHK

"Blackstar" wrote in message
oups.com...
Hi,

I have to add a custom footer to every excel document based on an
enviromental variable. This isn't a problem I've got the vb/vba code
to do this. My problem is that I'm not really sure where to put it.

No matter what the document is or what template it is based on I need
to run this code. I was wondering if I should put it in Excel10.xlb or
is there somewhere else that is always checked for code?

If I put it in Excel10.xlb will I also need to put it in any existing
templates that are used?

Thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Run macro for all documents

App Level events...genius. Many thanks
NickHK wrote:
If you need this code to run when any file is printed/opened/saved, you will
to look into Application Level events.
http://www.cpearson.com/excel/AppEvent.htm

NickHK

"Blackstar" wrote in message
oups.com...
Hi,

I have to add a custom footer to every excel document based on an
enviromental variable. This isn't a problem I've got the vb/vba code
to do this. My problem is that I'm not really sure where to put it.

No matter what the document is or what template it is based on I need
to run this code. I was wondering if I should put it in Excel10.xlb or
is there somewhere else that is always checked for code?

If I put it in Excel10.xlb will I also need to put it in any existing
templates that are used?

Thanks


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
Using Excel Macro to Print Word Documents Mike[_109_] Excel Programming 2 July 24th 06 06:30 PM
Menu linked to macro showing up in all documents Sean Excel Programming 1 October 20th 05 08:56 PM
Creating Word Documents with an Excel Macro The Wonder Thing[_2_] Excel Programming 1 June 19th 04 12:15 AM
Macro assignations follow new documents Wally Excel Programming 6 May 10th 04 03:48 PM
listing which documents were changed by macro alan Excel Programming 1 December 7th 03 05:25 AM


All times are GMT +1. The time now is 07:20 PM.

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"