Quote:
Originally Posted by NeoPa
Willis,
Could you please post the Error Message and perhaps repost the code in the code tags formatted as it would be normally.
That would make life so much easier.
It's really hard to scan through code without any of the visual symbols included in normal code formatting (indentation etc).
*****************
Below is the code, however the following is selected when I get:
Microsoft Office Word Quote:
This operation cannot be completed because of dialog or database engine failures. Please try again later
After clicking 'Okay' the following error message is returned:
Quote:
Run-time Error '5922'
the code in quotes is highlighted
*********************
- Dim wdApp As Word.Application
-
Set wdApp = CreateObject("Word.Application")
-
wdApp.Visible = False
-
xPathDoc = "C:\Documents and Settings\BDA Software\LienWaiver.doc"
-
Dim wd As Word.Document
-
Set wd = wdApp.Documents.Open(xPathDoc, , True)
-
Dim wdMM As Word.MailMerge
-
Set wdMM = wdApp.Documents(xPathDoc).MailMerge
-
With wdMM
-
.MainDocumentType = wdFormLetters
-
-
Quote:
-
-
.OpenDataSource Name:="C:\Documents and Settings\BDA Software\Database.mdb", _
-
LinktoSource:=True, _
-
Connection:="TABLE tblLienWaiver", _
-
SQLStatement:="SELECT * from tblLienWaiver"
-
-
.Destination = wdSendToPrinter -
.SuppressBlankLines = False
-
With .DataSource
-
.FirstRecord = wdDefaultFirstRecord
-
.LastRecord = wdDefaultLastRecord
-
End With
-
.Execute 'Pause:=False
-
End With