|
-
Mar 26th, 2003, 02:48 PM
#1
Thread Starter
Junior Member
Help Required Urgently:In Continuation of thread Id=234230
Please refer to thread following thread http://www.vbforums.com/showthread.p...hreadid=234230
The problem is whenever I try to open the .doc file for mail merge, it's throwing an error that word was unable to open datasource.
wrd.Visible = True
wrd.Documents.Add()
wrd.ActiveDocument.MailMerge.MainDocumentType = Word.WdMailMergeMainDocType.wdFormLetters
'wrd.ActiveDocument.MailMerge.OpenDataSource(Name:="p:\mail.doc")
wrd.ActiveDocument.MailMerge.OpenDataSource(Name:="P:\mail.doc", PasswordDocument:="", WritePasswordDocument:="", SQLStatement:="" & "", Connection:="", LinkToSource:=True)
Also if you could explain what's happening in the line before. As I do not have any SQL statement to pass. I've a dataset which contains data for the Mail Merge document.
On a second thought if do pass my SQL statement and Connection string, would it automatically create the form letters for all the records get retreived from the SQL statement.
This was just hard coded test data
wrd.ActiveDocument.MailMerge.Fields.Add(Range:=wrd.Selection.Range, Name:="FirstName")
wrd.Selection.TypeText("First")
wrd.ActiveDocument.MailMerge.Fields.Add(Range:=wrd.Selection.Range, Name:="LastName")
wrd.Selection.TypeText("Last")
wrd.ActiveDocument.MailMerge.Fields.Add(Range:=wrd.Selection.Range, Name:="Address")
wrd.Selection.TypeText("Edmonton").
Could you please advise.
Thanks
Note: LSG[static], I did send you email in regards to this.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|