PDA

View Full Version : Prevent code from running when opening template



debspink
08-18-2011, 08:19 AM
I need to be able to iterate through a folder with several templates in it, open them, extract information (eg autotext, margin settings etc) then close without saving. However the templates all have code in them and when I open the file using code, it tries to run the code (this is in 2003, in 2010 it just says there is a hidden module) Is there anyway round this, ie to stop the code in the template running?

Alternatively, is there an equivalent to pressing Shift File New to create a new document with the code running, so I can extract the info from that?

Happy for this to work in either 2003 or 2010.

Thanks,
Debs

Frosty
08-18-2011, 12:15 PM
wordbasic.disableautomacros 1 'disable
wordbasic.disableautomacros 0 'enable

Amazing that it's still useful, but it is.

debspink
08-19-2011, 01:59 AM
Thanks Frosty, that's great - seems to be working!

Debs