Can anyone help with the following incompatibility problem between office 2k
and office xp?
The code below works OK in Access 2k. But on a PC with office XP, it fails
at the "Set appword . . . " line with "runtime error 429: ActiveX component
can't create object".
Is there a way of coding this to work on both 2k and XP; or does something
need to be changed on the XP PC? The MS knowledgebase gives a workaround
that seems to retry the GetObject function at timed intervals, but the
workaround uses XP code that won't run on 2k. I'm using 2k myself, and
don't have easy access to XP for testing.
Would be very grateful for any suggestions. Thanks
Dave H
** START OF CODE EXTRACT
Dim appWord As Word.Application
' Switch to Microsoft Word so it won't go away when you finish.
On Error Resume Next
AppActivate "Microsoft Word"
' If Word isn't running, start and activate it.
If Err Then
Shell "c:\Program Files\Microsoft Office\Office\" & "Winword
/Automation", vbMaximizedFocus
AppActivate "Microsoft Word"
End If
On Error GoTo 0
' Get an appication object so you can automate Word
Set appWord = GetObject(, "Word.Application")
' Open a document based on the memo template, turn off the automatic
spell check, and move to the MemoToLine bookmark
With appWord
.Documents.Add wordtemplate_path
.ActiveDocument.ShowSpellingErrors = False
[. . Do various things with the document . . ]
End With
** END OF CODE EXTRACT
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.713 / Virus Database: 469 - Release Date: 30/06/2004