Connecting Tech Pros Worldwide Help | Site Map

VB6 and mailmerge

  #1  
Old March 20th, 2007, 09:15 PM
Geoff
Guest
 
Posts: n/a
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


  #2  
Old March 21st, 2007, 01:45 PM
Ralph
Guest
 
Posts: n/a

re: VB6 and mailmerge



"Geoff" <gfriar@freenetname.co.ukwrote in message
news:loSdnXDLLf59o53bnZ2dnUVZ8sGvnZ2d@brightview.c om...
Quote:
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:
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/lib...ffice.10).aspx
http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx

-ralph


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Word mailmerge from VB6 code937 answers 2 October 11th, 2007 03:12 AM
visual basic data report problem nmurali answers 2 June 14th, 2007 06:55 AM
Problem with VB6 and mailmerge in Word Allcomp answers 1 July 17th, 2005 10:31 PM