M
Max
Hi,
I have been using Automation in Access 2003 to open a word mailmerge
document based on a text file exported from Access 2003. Everything has been
working fine until the latest service pack upgrade and now the merge fields
are not filled.
If I step through the code manually the only difference is that when I open
the document I recieve a prompt:
"Opening this document will run the following SQL command:
SELECT * FROM C:\Documents and Settings\Max\My Documents\My Data
Sources\tempmrg.txt
Data from your database will be placed in the document. Do you want to
continue?"
If I select the Yes box everything works fine again.
Can I trigger this with automation?
Max
The main code used is as follows:
DoCmd.Hourglass False
With appWord
.Activate
.Application.Visible = True
.Application.ChangeFileOpenDirectory (DocPath)
.Documents.Add DocTemplate
.WindowState = wdWindowStateMaximize
.Application.CommandBars("Mail Merge").Visible = False
With .ActiveDocument
.ShowSpellingErrors = False
.View.ShowFieldCodes = False
.ActiveWindow.View.MailMergeDataView = False
.MailMerge.ViewMailMergeFieldCodes = False
.Fields.unlink
If Me.SaveDoc = True Then
.SaveAs FileName:=DocPath & Me![DocFileName]
End If
If Me![DocType] = "Labels 3 x 7" Then
.ActivePrinter = "Label Spooler local on LPT1:"
End If
End With
End With
Set appWord = Nothing
I have been using Automation in Access 2003 to open a word mailmerge
document based on a text file exported from Access 2003. Everything has been
working fine until the latest service pack upgrade and now the merge fields
are not filled.
If I step through the code manually the only difference is that when I open
the document I recieve a prompt:
"Opening this document will run the following SQL command:
SELECT * FROM C:\Documents and Settings\Max\My Documents\My Data
Sources\tempmrg.txt
Data from your database will be placed in the document. Do you want to
continue?"
If I select the Yes box everything works fine again.
Can I trigger this with automation?
Max
The main code used is as follows:
DoCmd.Hourglass False
With appWord
.Activate
.Application.Visible = True
.Application.ChangeFileOpenDirectory (DocPath)
.Documents.Add DocTemplate
.WindowState = wdWindowStateMaximize
.Application.CommandBars("Mail Merge").Visible = False
With .ActiveDocument
.ShowSpellingErrors = False
.View.ShowFieldCodes = False
.ActiveWindow.View.MailMergeDataView = False
.MailMerge.ViewMailMergeFieldCodes = False
.Fields.unlink
If Me.SaveDoc = True Then
.SaveAs FileName:=DocPath & Me![DocFileName]
End If
If Me![DocType] = "Labels 3 x 7" Then
.ActivePrinter = "Label Spooler local on LPT1:"
End If
End With
End With
Set appWord = Nothing