Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code to stop a macro from running

Status
Not open for further replies.

arbo80

Programmer
Jan 5, 2006
53
US
Hi,

I create a macro to automatically update excel reports everyday and archive them. The macro automatically starts when I open the excel file, then it retrieves data and saves a copy of the file with a different name for archiving purpose. However, when a user opens one of the archived file, the macro automatically re-starts. I don't what that. Is there anyway that I can stop the macro from running in those documents? Is there any code that I should add in the original report?
 
There's more than one way to approach this, including having your macro run in a "code only" workbook or Add-In. Perhaps easier for your current setup is to have the macro code copy the relevant sheets to a new workbook then save with the different name. This would replace what it is currently doing; i.e., doing a SaveAs which saves the entire workbook, including code modules.


Regards,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top