Automation

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
 
M

Max

I tried your suggestion but it does not work.
If I simply open the document in word, without using automation, I get the
same message box no matter how I set the document security settings.


TC said:
Try the AutomationSecurity property:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;317405

And, post back whether it works or not! I don't have office 2003 yet, to
check.

HTH,
TC


Max said:
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
 
T

TC

The property is only relevant when you are using automation. It is not
relevant when you run Word manually.

HTH,
TC


Max said:
I tried your suggestion but it does not work.
If I simply open the document in word, without using automation, I get the
same message box no matter how I set the document security settings.


TC said:
Try the AutomationSecurity property:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;317405

And, post back whether it works or not! I don't have office 2003 yet, to
check.

HTH,
TC


Max said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top