copying a module

cbennetts

New Member
Joined
Feb 23, 2004
Messages
29
Good Day all.
Here is the deal, I have a workbook which is called HM2005Nov23 that does automatic queries to the net every second. That runs just fine. When I get an error though (ie 1004) I want it to clone itself (modules and all) into another book that is titled the same but with a .1, .2, .3 etc. depending on how many times it has had to clone itself. After it clones itself I want it to delete the old version of itself and then start the web query again. Any suggestions?

Chet
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Sounds like exactly what I want to do. Would it look something like this:

Sub kill()
'
'Other applicable code
'
Workbooks("try to kill").kill
'
'Other applicable code
'
End Sub
 
Upvote 0
If you're using SaveAs to create a new copy of the workbook, the module will get saved in the new workbook also. There shouldn't be a need for exporting/importing the module itself.

BTW, I didn't ignore your PM. When I tried using the relevent code to export/import Module1 between a couple workbooks, Norton freaked out. Said I had a Bloodhound virus named "ExcelMacro". Had a bit of a time getting rid of those two workbooks.
(Now Norton is happy again.)
 
Upvote 0
That is the same problem I had too. Interesting. I will try the save as instead. Thanks and Happy Turkey Day!

Chet
 
Upvote 0

Forum statistics

Threads
1,213,526
Messages
6,114,122
Members
448,550
Latest member
CAT RG

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top