Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / September 2004

Tip: Looking for answers? Try searching our database.

Macro and AutoText Disabled

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Scott May - 09 Sep 2004 22:36 GMT
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
Cindy M  -WordMVP- - 14 Sep 2004 14:58 GMT
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 :-)
Scott May - 14 Sep 2004 21:46 GMT
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

> Hi Scott,
>
[quoted text clipped - 25 lines]
> This reply is posted in the Newsgroup; please post any follow question or
> reply in the newsgroup and not by e-mail :-)
Cindy M  -WordMVP- - 15 Sep 2004 10:07 GMT
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
[quoted text clipped - 10 lines]
>  
> 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 :-)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.