Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default Remove/disable event macros in SavedAs wkbk?

I have a "master template" workbook. When the user fills in certain
information, the workbook generates a name for itself and performs a SaveAs
NewFileName.

The master has Open, Close, and Worksheet_Change events that are not needed
in the new workbooks. Is there an easy way to remove or disable these event
codes when the new workbook is created by SaveAs?

Ed


  #2   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default Remove/disable event macros in SavedAs wkbk?

If you don't want to edit the VBA directly when you save it by removing the
uneeded modules, you could put an if statement in each event that checks the
name of the workbook, if it is not the "master template" then do not run.
ben

"Ed" wrote:

I have a "master template" workbook. When the user fills in certain
information, the workbook generates a name for itself and performs a SaveAs
NewFileName.

The master has Open, Close, and Worksheet_Change events that are not needed
in the new workbooks. Is there an easy way to remove or disable these event
codes when the new workbook is created by SaveAs?

Ed



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Remove/disable event macros in SavedAs wkbk?

Chip Pearson has some instructions on how to remove code on the fly.
http://www.cpearson.com/excel/vbe.htm

But I like Ben's suggestion, too.

If the template is really a template (*.xlt) and the workbook that's created is
really a new workbook based on that template, you can check the path of that
workbook. If it's = "", then the workbook hasn't been saved and you can do your
stuff.

option explicit
sub workbook_open()
if me.path < "" then
exit sub
end if

'keep going
end sub


Ed wrote:

I have a "master template" workbook. When the user fills in certain
information, the workbook generates a name for itself and performs a SaveAs
NewFileName.

The master has Open, Close, and Worksheet_Change events that are not needed
in the new workbooks. Is there an easy way to remove or disable these event
codes when the new workbook is created by SaveAs?

Ed


--

Dave Peterson
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
Disable SelectionChange Event BillCPA Excel Discussion (Misc queries) 2 February 17th 06 06:45 PM
Disable or remove macros for a workbook to be sent in email... [email protected] Excel Programming 3 January 13th 05 03:31 PM
Convert XL2K wkbk w/ macros to XL97? Ed[_9_] Excel Programming 1 February 13th 04 08:46 PM
Suppress the Disable Macros / Enable Macros Dialog Shoji Karai Excel Programming 5 September 24th 03 03:10 AM
Disable Worksheet change event Tim[_14_] Excel Programming 4 July 15th 03 01:27 AM


All times are GMT +1. The time now is 02:33 PM.

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

About Us

"It's about Microsoft Excel"