Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runtime error 5852 during Access-Word mail merge 1

Status
Not open for further replies.

Creosote65

Technical User
Jun 28, 2004
29
US
Hi all,

About six months ago, I created a function in Access 2002 that would perform a mail merge based on a template file in Word. The mail merge portion goes as follows:

With docWord.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With

It has worked without a hitch for the last six months. Yesterday, a new employee started, and the IT guys set her up with a computer built from a ghost file. Now, vba is saying that the ".Destination = wdSendToNewDocument" line generates a "runtime error 5852" message stating that the requested object is not available.

So my question is in two parts:
1- How do I fix this so that my line works and the mail merge completes?
2- Why does the current syntax work with everyone except the new employee? All software versions are the same.

Any help would be greatly appreciated.

Creosote
 
I think this results from a new security setting in Word 2003, which prompts the user for verification when opening a datasource. The default value is no (No, don't attach the datasource), and when using automation, you are not given the opportunity to respond "yes". This security feature is also a problem in Word 2003 SP-3.
There is a workaround, but it involves a registry change.

I read about it in:
after much searching. I'll let you know if it works.
 
Hi JoyInOK,

The register edit that you referenced is exactly what is needed to resolve the error. I added the setting and everything is functioning normally.

Thanks,

Creo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top