D
Dedge
Hi. Can anyone help me with the following?
The code below works OK in Access 2000. But when it was
installed on a PC with office XP, it failed 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?
Does something need to be changed on the xp PC? I'm using
2k myself, and don't have easy access to xp for testing.
Would be very grateful for any suggestions. Thanks
** 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, etc.
With appWord
.Documents.Add wordtemplate_path
[. . Do various things with the document . . ]
End With
** END OF CODE EXTRACT
The code below works OK in Access 2000. But when it was
installed on a PC with office XP, it failed 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?
Does something need to be changed on the xp PC? I'm using
2k myself, and don't have easy access to xp for testing.
Would be very grateful for any suggestions. Thanks
** 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, etc.
With appWord
.Documents.Add wordtemplate_path
[. . Do various things with the document . . ]
End With
** END OF CODE EXTRACT