Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 05-20-2014, 01:19 AM
macropod's Avatar
macropod macropod is offline code to run once only Windows 7 32bit code to run once only Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Assuming your macro resides in a template, there isn't any code to be removed from the document. But, since your code is incomplete, missing the vital sub name, I can't tell how it's triggered. The links I posted both show code that will only run of its own accord when a new document is created from the template.

If, however, you're using a document and simply copying it (bad idea), you will have great difficulty in running a macro from that document to delete all macros in the document. After all, as soon as it deletes its own code module, it'll stop running. Apart from that, Word would require trusted access to the VBA project (unwise as a normal setting) and that can't be given programmatically.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
code to run once only Need Help with Below Code rsrasc Word VBA 6 04-01-2014 03:42 PM
code to run once only Where does my code go? rbaldwin Word VBA 3 03-14-2012 02:31 PM
code to run once only vbc code rajpeter Excel Programming 2 09-13-2011 02:29 PM
vba code in excel rajpeter Excel Programming 5 09-11-2011 06:13 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:19 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft