AutoMacro off and on

A

Alan UK

I have a macro that I want to use to "refresh" the
document on the C drive with the updated version
maintained on the Network drive. As the documents contain
automacros I have used:

Sub Refresher()

WordBasic.DisableAutoMacros
Documents.Open FileName:="H:\test.doc", ReadOnly:=True
ActiveDocument.SaveAs "C:\My Documents\test.doc"
ActiveDocument.Close

End Sub

The only problem then is that the only way I have found to
re-activate the automacro is to quit the application-
which is not ideal as I would like the refresh to occur at
each Word application open, and I would be looping(!)

I cannot locate the equivalent of
"WordBasic.EnableAutoMacros" in terms of functionality.
Is there some coding I can use instead of quitting word,
or another method of disbling the automacro that also has
a reactivation code?
 
P

Peter Hewett

Hi Alan UK

Try this:

Sub Refresher()
WordBasic.DisableAutoMacros True
Documents.Open FileName:="H:\test.doc", ReadOnly:=True
ActiveDocument.SaveAs "C:\My Documents\test.doc"
ActiveDocument.Close
WordBasic.DisableAutoMacros False
End Sub

HTH + Cheers - Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top