C
Cheryl
Automation has worked for over a year but stopped working after a recent
security patch. Users log onto an Access 97 database over a terminal
server, select a record to merge, and Word 2002 and the document open
via code in Access. The data source in .rtf format. The Access 97 code
to merge looks like this:
Function HearingNotice()
'Private Sub Command18_Click()
Dim appWd As Word.Application
Dim appDoc As Word.Document
On Error GoTo notloaded
Set appWd = GetObject(, "Word.Application.8")
appWd.Visible = True
notloaded:
If Err.Number = 429 Then
Set appWd = CreateObject("Word.Application.8")
' theError = Err.Number
End If
appWd.Visible = True
Dim varMyAppID
Dim varReturnValue
' In Microsoft Windows:
AppActivate "Microsoft Word" ' Activate Microsoft
' Word.
appWd.Documents.Open "C:\HearingNotice.doc"
appWd.Visible = True
Set appWd = Nothing
End Function
The merge documents are coded to auto open like this:
Sub AutoOpen()
Application.Run MacroName:="Merge"
Documents("HearingNotice.doc").Close SaveChanges:=wdDoNotSaveChanges = True
End Sub
There is a global template loaded with the macros that are standard to
all documents, like the "merge" one above. The macros are visible in the
macro dialog box.
Merging from the database no longer works. I get a "Run-time Error 5852,
Requested Object not Available." However, if I open Word first, click on
File - Open and the document name, it merges through without error. It
seems like it's not reading the global template when Word opens (thru
automation), but is reading the code in the document.
Any ideas? Thanks.
security patch. Users log onto an Access 97 database over a terminal
server, select a record to merge, and Word 2002 and the document open
via code in Access. The data source in .rtf format. The Access 97 code
to merge looks like this:
Function HearingNotice()
'Private Sub Command18_Click()
Dim appWd As Word.Application
Dim appDoc As Word.Document
On Error GoTo notloaded
Set appWd = GetObject(, "Word.Application.8")
appWd.Visible = True
notloaded:
If Err.Number = 429 Then
Set appWd = CreateObject("Word.Application.8")
' theError = Err.Number
End If
appWd.Visible = True
Dim varMyAppID
Dim varReturnValue
' In Microsoft Windows:
AppActivate "Microsoft Word" ' Activate Microsoft
' Word.
appWd.Documents.Open "C:\HearingNotice.doc"
appWd.Visible = True
Set appWd = Nothing
End Function
The merge documents are coded to auto open like this:
Sub AutoOpen()
Application.Run MacroName:="Merge"
Documents("HearingNotice.doc").Close SaveChanges:=wdDoNotSaveChanges = True
End Sub
There is a global template loaded with the macros that are standard to
all documents, like the "merge" one above. The macros are visible in the
macro dialog box.
Merging from the database no longer works. I get a "Run-time Error 5852,
Requested Object not Available." However, if I open Word first, click on
File - Open and the document name, it merges through without error. It
seems like it's not reading the global template when Word opens (thru
automation), but is reading the code in the document.
Any ideas? Thanks.