View Single Post
  #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!