Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copying ThisWorkBook Events

I have to create 40+ workbooks from a single "template" workbook. These
workbooks will be used by collegues throughout the organization during their
daily analysis of financial data. One of the goals of these workbooks is to
sort the corresponding rows based on a specific column (column L). This sort
needs to occur only during the BeforeSave event and needs to be transparent
to the user.

I wanted to put the sort code in the ThisWorkBook BeforeSave event and
programatically use VBE to create the component in each of the 40+ workbooks.
Unfortnately, the "template" workbook's BeforeSave event code will not copy
to the 40+ workbooks. I also tried creating a separate class module to
handle event programming and this works only if I have a reference to the
event class from the newly created workbook.

Since I will have to have this code in 40+ workbooks, I wanted to see if
anyone knew how to copy the Thisworkbook's BeforeSave code to other workbooks?

Thanks for the help.
--
Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copying ThisWorkBook Events

Export the code, then import it into the target workbook(s).

Regards,
Tom Ogilvy

"mark_1969" wrote in message
...
I have to create 40+ workbooks from a single "template" workbook. These
workbooks will be used by collegues throughout the organization during

their
daily analysis of financial data. One of the goals of these workbooks is

to
sort the corresponding rows based on a specific column (column L). This

sort
needs to occur only during the BeforeSave event and needs to be

transparent
to the user.

I wanted to put the sort code in the ThisWorkBook BeforeSave event and
programatically use VBE to create the component in each of the 40+

workbooks.
Unfortnately, the "template" workbook's BeforeSave event code will not

copy
to the 40+ workbooks. I also tried creating a separate class module to
handle event programming and this works only if I have a reference to the
event class from the newly created workbook.

Since I will have to have this code in 40+ workbooks, I wanted to see if
anyone knew how to copy the Thisworkbook's BeforeSave code to other

workbooks?

Thanks for the help.
--
Mark



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copying ThisWorkBook Events

Tom,

Thanks for the reply. I thought of exporting the code and manually
importing it, but this is a daunting task for 40+ workbooks on a daily basis.
Any idea on how to do this programmatically?

"Tom Ogilvy" wrote:

Export the code, then import it into the target workbook(s).

Regards,
Tom Ogilvy

"mark_1969" wrote in message
...
I have to create 40+ workbooks from a single "template" workbook. These
workbooks will be used by collegues throughout the organization during

their
daily analysis of financial data. One of the goals of these workbooks is

to
sort the corresponding rows based on a specific column (column L). This

sort
needs to occur only during the BeforeSave event and needs to be

transparent
to the user.

I wanted to put the sort code in the ThisWorkBook BeforeSave event and
programatically use VBE to create the component in each of the 40+

workbooks.
Unfortnately, the "template" workbook's BeforeSave event code will not

copy
to the 40+ workbooks. I also tried creating a separate class module to
handle event programming and this works only if I have a reference to the
event class from the newly created workbook.

Since I will have to have this code in 40+ workbooks, I wanted to see if
anyone knew how to copy the Thisworkbook's BeforeSave code to other

workbooks?

Thanks for the help.
--
Mark




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copying ThisWorkBook Events

If you creating the workbooks on a daily basis, why not create them from a
template that already contains the code.

In any event, see Chip Pearson's page on programming the VBE

http://www.cpearson.com/excel/vbe.htm

--
Regards,
Tom Ogilvy


"mark_1969" wrote in message
...
Tom,

Thanks for the reply. I thought of exporting the code and manually
importing it, but this is a daunting task for 40+ workbooks on a daily

basis.
Any idea on how to do this programmatically?

"Tom Ogilvy" wrote:

Export the code, then import it into the target workbook(s).

Regards,
Tom Ogilvy

"mark_1969" wrote in message
...
I have to create 40+ workbooks from a single "template" workbook.

These
workbooks will be used by collegues throughout the organization during

their
daily analysis of financial data. One of the goals of these workbooks

is
to
sort the corresponding rows based on a specific column (column L).

This
sort
needs to occur only during the BeforeSave event and needs to be

transparent
to the user.

I wanted to put the sort code in the ThisWorkBook BeforeSave event and
programatically use VBE to create the component in each of the 40+

workbooks.
Unfortnately, the "template" workbook's BeforeSave event code will not

copy
to the 40+ workbooks. I also tried creating a separate class module

to
handle event programming and this works only if I have a reference to

the
event class from the newly created workbook.

Since I will have to have this code in 40+ workbooks, I wanted to see

if
anyone knew how to copy the Thisworkbook's BeforeSave code to other

workbooks?

Thanks for the help.
--
Mark






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
ThisWorkbook.FullName Steph[_3_] Excel Programming 3 November 23rd 04 08:41 PM
Copying "ThisWorkbook" objects rpgun[_4_] Excel Programming 0 October 26th 04 12:35 PM
Copying "ThisWorkbook" objects rpgun[_3_] Excel Programming 1 October 25th 04 09:57 PM
Calling Sub(s) from ThisWorkbook BSchwerdt Excel Programming 1 December 11th 03 01:36 AM
ThisWorkbook variables... Jim Carlock[_2_] Excel Programming 13 September 1st 03 03:09 AM


All times are GMT +1. The time now is 08:11 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"