Macro and AutoText Disabled

S

Scott May

I am doing a mailmerge programatically from VB.NET to Word2000. Mailmerge
goes fine but the macro's and autotext are disabled. I think since I am
opening the template document programatically word is disabling the macro.
Is there a way to tell word to not do this?

Thanks

Scott
 
C

Cindy M -WordMVP-

Hi Scott,
I am doing a mailmerge programatically from VB.NET to Word2000. Mailmerge
goes fine but the macro's and autotext are disabled. I think since I am
opening the template document programatically word is disabling the macro.
Is there a way to tell word to not do this?
All versions of Word have a macro security with three settings (four in
2003): "High", "Medium" and "Low". The first disables macros without asking;
the second dislays a prompt; the third lets all macros execute.

Word 2002 introduced the AutomationSecurity property for the application
object that lets you open documents using automation with the setting you
prefer. Nothing like this is available in Word 2000, however.

Either the user has to set the macro security on the machine to "Low" (if
there's good anti-virus software this shouldn't be a problem) or you have to
get the macros out of the main merge documents.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
S

Scott May

Cindy, Thank you for taking the time to answer this. Have a question or two,
though.

You say that in Word 2003 the Word object model has a AutomationSecurity so
would the code look something like this

Dim WordApp As Object
Dim WordDoc As Object

WordApp = CreateObject("Word.Application")

If Val(WordApp.Version) > 9 Then
WordApp.AutomationSecurity = 0
End If

WordDoc = WordApp.Documents.Open(FileName)

Then do the mail merge?

Thanks so much!!

Scott May
 
C

Cindy M -WordMVP-

Hi Scott,
You say that in Word 2003 the Word object model has a AutomationSecurity so
would the code look something like this
Basically, yes. Except that I'd test >= 10 because service packs sometimes
cause the version to come back as something like 9.1.
Dim WordApp As Object
Dim WordDoc As Object

WordApp = CreateObject("Word.Application")

If Val(WordApp.Version) > 9 Then
WordApp.AutomationSecurity = 0
End If

WordDoc = WordApp.Documents.Open(FileName)

Then do the mail merge?

Thanks so much!!

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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