Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Transfer control to new module in macro

I need to delete all macros and vbComponents on save. I'm able to
perform all the vb Component deletions but I can't figure out how to
transfer control to a new module that deletes all other modules. All is
well when I execute the Delete_Macros module by itself but my attempts
at transferring control to it from the Delete_vbComponents module result
in the calling module not being deleted. What am I missing?

BrianG



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
jaf jaf is offline
external usenet poster
 
Posts: 300
Default Transfer control to new module in macro

Hi Brian,
You can't delete the code module that the code is running in no matter where
it is.

A possible solution would be to open another workbook.
Use application.run to run a code module in wb2 that deletes the modules in
wb1 and then closes.


--

John

johnf202 at hotmail dot com


"BrianG" wrote in message
...
I need to delete all macros and vbComponents on save. I'm able to
perform all the vb Component deletions but I can't figure out how to
transfer control to a new module that deletes all other modules. All is
well when I execute the Delete_Macros module by itself but my attempts
at transferring control to it from the Delete_vbComponents module result
in the calling module not being deleted. What am I missing?

BrianG



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Transfer control to new module in macro

"jaf" wrote in message
You can't delete the code module that the code is running in no matter where
it is.


I have my Auto_Open sub in Module1. I then call a Sub in Module2 to
delete Module1. If I run the Sub by itself, Module1 gets deleted but
if let Module1 call the Sub in Module2, Module1 does not get deleted.
I need to automatically delete the Auto_Open sub so that it doesn't
run on subsequent opens.

If I can't cut the ties to Module1 so that it can be deleted by a Sub
in Module2, is opening another workbook the only way?

BrianG

"jaf" wrote in message ...
Hi Brian,
You can't delete the code module that the code is running in no matter where
it is.

A possible solution would be to open another workbook.
Use application.run to run a code module in wb2 that deletes the modules in
wb1 and then closes.


--

John

johnf202 at hotmail dot com


"BrianG" wrote in message
...
I need to delete all macros and vbComponents on save. I'm able to
perform all the vb Component deletions but I can't figure out how to
transfer control to a new module that deletes all other modules. All is
well when I execute the Delete_Macros module by itself but my attempts
at transferring control to it from the Delete_vbComponents module result
in the calling module not being deleted. What am I missing?

BrianG



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

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
Hiding part of VBA or a Module in Macro Iraj Excel Discussion (Misc queries) 3 March 23rd 12 11:47 AM
Which macro module wal50 Excel Discussion (Misc queries) 4 March 17th 09 07:46 PM
Delete macro that is not in a module [email protected] Excel Discussion (Misc queries) 5 September 21st 07 06:15 PM
macro to standard module Simon Excel Discussion (Misc queries) 9 May 17th 07 08:25 PM
Assigning a module to a button macro DMB Excel Discussion (Misc queries) 2 January 19th 06 12:37 AM


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