Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Access - Word Automation. (-2147023174 Automation Error)
Message
From
12/11/1998 06:58:58
 
 
To
11/11/1998 08:17:47
General information
Forum:
Visual Basic
Category:
VBA
Miscellaneous
Thread ID:
00156527
Message ID:
00156893
Views:
52
>Hi all !
>
>Here my problem : I have a Access database and a form. On the form, I have a button. When I click this button I take active this code.
>(Mail Merge Process). When I execute the first time this code everything go right the user close the word application after but the problem appear when i try to execute a second time. The wordtest is created successful but mymerge give this error.
>
>Here the code :
>
>Dim mymerge As word.MailMerge
>Dim wordTest As Object
>
>Set wordTest = CreateObject("word.basic")
>
>With wordTest
> .fileopen StrFileName
> .appmaximize
> Set mymerge = ActiveDocument.MailMerge
> mymerge.Execute
>End With
>
>Set mymerge = Nothing
>Set wordTest = Nothing
>
>End If
>
>Thank to all


OK, a few things you should know.

Try quitting Word after you use it: wordObject.Quit

If you want to use an already open Word, use GetObject instead of CreateObject

There's an Automation bug when you try to execute more then one time a piece of code that use Word. I have a similar problem right now on a project and I'm pulling my hair of my head !!
I haven't found an solution yet.
Guy Barrette, MCSD
============
Blog http://weblogs.asp.net/guybarrette
Microsoft Regional Director, Montreal, Canada www.microsoft.com/rd
MVP, ASP.NET http://mvp.support.microsoft.com/
President, Montreal Visual Studio User Group www.guvsm.net
INETA Regional Rep for Quebec www.ineta.org
UniversalThread Magazine Columnist (.NET Books Review Column) www.utmag.com
Tech Chair French Track, DevTeach 2004 & 2005 www.devteach.com
Business Architect, Microsoft Team - Nurun Inc www.nurun.com
XBox Live Gamer Tag: Slomo QC CA
Previous
Reply
Map
View

Click here to load this message in the networking platform