Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

VB6 and mailmerge

Question posted by: Geoff (Guest) on March 20th, 2007 08:15 PM
Really not too sure what I am doing. I would like to launch MS Word from
VB6 so that it will mail- merge with a comma delimited text file called
Data.txt. The code below launches MS Word but how to invoke the merge from
VB .. don't know



Many thanks Geoff





Private Sub Command1_Click()



On Error GoTo Err_merge_Click




'Load the mail merge document as an object

Dim objWord As Object

Set objWord = GetObject("E:\Word\VB\Merge.doc")


'Make Word visible

objWord.Application.Visible = True



Exit Sub



Err_merge_Click:

MsgBox Err.Description



End Sub


Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
Ralph's Avatar
Ralph
Guest
n/a Posts
March 21st, 2007
12:45 PM
#2

Re: VB6 and mailmerge

"Geoff" <gfriar@freenetname.co.ukwrote in message
news:loSdnXDLLf59o53bnZ2dnUVZ8sGvnZ2d@brightview.c om...
Quote:
Originally Posted by
Really not too sure what I am doing. I would like to launch MS Word from
VB6 so that it will mail- merge with a comma delimited text file called
Data.txt. The code below launches MS Word but how to invoke the merge

from
Quote:
Originally Posted by
VB .. don't know
>
>
>
Many thanks Geoff
>
>
>
>
>
Private Sub Command1_Click()
>
>
>
On Error GoTo Err_merge_Click
>
>
>
>
'Load the mail merge document as an object
>
Dim objWord As Object
>
Set objWord = GetObject("E:\Word\VB\Merge.doc")
>
>
'Make Word visible
>
objWord.Application.Visible = True
>
>
>
Exit Sub
>
>
>
Err_merge_Click:
>
MsgBox Err.Description
>
>
>
End Sub
>
>


"How to automate Word with Visual Basic to create a Mail Merge"
http://support.microsoft.com/kb/285332

You might find these articles useful...
http://msdn2.microsoft.com/en-us/li...office.10).aspx
http://msdn2.microsoft.com/en-us/li...office.10).aspx

-ralph



 
Not the answer you were looking for? Post your question . . .
184,011 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors