A Microsoft Word forum. Microsoft Office Word Forum - WordBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Microsoft Office Word Forum - WordBanter forum » Microsoft Word Newsgroups » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How to mailmerge word file using gmail?



 
 
Thread Tools Display Modes
  #1  
Old September 8th 09, 09:04 AM
maheshmaxi maheshmaxi is offline
Junior Member
 
First recorded activity by WordBanter: Sep 2009
Posts: 4
Question How to mailmerge word file using gmail?

Hi,

I do not have MS Outlook. I need to do mailmerge a word file. Can I use Gmail or yahoo or anyother mail.. Pls help me on this...

MaxX
Ads
  #2  
Old September 9th 09, 05:23 AM
maheshmaxi maheshmaxi is offline
Junior Member
 
First recorded activity by WordBanter: Sep 2009
Posts: 4
Question

Quote:
Originally Posted by maheshmaxi View Post
Hi,

I do not have MS Outlook. I need to do mailmerge a word file. Can I use Gmail or yahoo or anyother mail.. Pls help me on this...

MaxX
Hi

Could anyone let me is it possible with Gmail or Yahoomail...

MaxX
  #3  
Old September 9th 09, 08:49 AM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,583
Default How to attach a file on mail merge?

You can use the approach described by Doug Robbins at

http://word.mvps.org/FAQs/MailMerge/...ttachments.htm

There are also potentially simpler but less well-tested macros for
generating e-mails from Word, e.g. for mail messages with a plain text
body and an attachment you can try the following Word VBA. Each email
can only "consume" one record in the data source - i.e., no NEXT/NEXTIF
fields etc..

Graham Mayor has some instructions for installing and running VBA at

http://www.gmayor.com/installing_macro.htm

Sub EmailOneDocPerSourceRecWithBody()
Dim bOutlookStarted As Boolean
Dim bTerminateMerge As Boolean
Dim intSourceRecord As Integer
Dim objMailItem As Outlook.MailItem
Dim objMerge As Word.MailMerge
Dim objOutlook As Outlook.Application
Dim strMailSubject As String
Dim strMailTo As String
Dim strMailBody As String
Dim strOutputDocumentName As String
bOutlookStarted = False
bTerminateMerge = False
' Set up a reference to the
' Activedocument, partly because
' the ActiveDocument changes as you
' merge each record
Set objMerge = ActiveDocument.MailMerge
' Start Outlook as necessary
On Error Resume Next
Set objOutlook = GetObject(, "Outlook.Application")
If Err 0 Then
Set objOutlook = CreateObject("Outlook.Application")
bOutlookStarted = True
End If
With objMerge
' If no data source has been defined,
' do it here using OpenDataSource.
' But if it is already defined in the
' document, you should not need to
' define it here.
' .OpenDataSource _
' Name:="whatever"
intSourceRecord = 1
Do Until bTerminateMerge
.DataSource.ActiveRecord = intSourceRecord
' if we have gone past the end
' (and possibly, if there are no records)
' then the Activerecord will not be what
' we have just tried to set it to
If .DataSource.ActiveRecord intSourceRecord Then
bTerminateMerge = True
' the record exists
Else
' while we are looking at the
' correct activerecord,
' create the mail subject, body, "to" and "cc"
' Just some sample code here - replace it with
' whatever you need. But ensure that the field names
' match the ones in your data source exactly - uppercase/lowercase
' differences are significant here
strMailSubject = _
"Results for " & _
objMerge.DataSource.DataFields("Firstname") & _
" " & objMerge.DataSource.DataFields("Lastname")
strMailBody = _
"Dear " & objMerge.DataSource.DataFields("Firstname") & _
vbCrLf & _
"Please find attached a Word document containing" & vbCrLf & _
"your results for..." & vbCrLf & _
vbCrLf & _
"Yours" & vbCrLf & _
"Your name"
strMailTo = objMerge.DataSource.DataFields("Emailaddress")
' create the document path name
' In this case it can be the same for every recipient,
' but if you want to retain copies of the
' document, you can use info. in the data source
' this is an example - insert your
' own pathname here
strOutputDocumentName = "c:\a\results.doc"
' strOutputDocumentName = _
' "c:\mymergeletters\_" & _
' .DataSource.DataFields("Lastname").Value & _
' " letter.doc"
.DataSource.FirstRecord = intSourceRecord
.DataSource.LastRecord = intSourceRecord
.Destination = wdSendToNewDocument
.Execute
' The Activedocument is always the
' output document
' Add any parameters you need to these calls
ActiveDocument.SaveAs strOutputDocumentName
ActiveDocument.Close
' Now create a mail item
Set objMailItem = objOutlook.CreateItem(olMailItem)
With objMailItem
.Subject = strMailSubject
.Body = strMailBody
.To = strMailTo
.CC = strMailCC
.VotingOptions = strVotingOptions
.Attachments.Add strOutputDocumentName, olByValue, 1
'.Save
.Send
End With
Set objMailItem = Nothing
intSourceRecord = intSourceRecord + 1
End If
Loop
End With
' Close Outlook if appropriate
If bOutlookStarted Then
objOutlook.Quit
End If
Set objOutlook = Nothing
Set objMerge = Nothing
End Sub

Peter Jamieson

http://tips.pjmsn.me.uk
Visit Londinium at http://www.ralphwatson.tv

maheshmaxi wrote:
Hi,

I would like to send mails using mail merge. But also I want an
attachment to be enclosed with the mail. Could anyone help me on
this...

MaxX




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I send a word doc in the body of a gmail email? sallym7777 Microsoft Word Help 2 February 15th 09 11:17 PM
Using Gmail GB[_2_] New Users 7 November 25th 08 06:38 PM
how can I use gmail instead of Outlook? eglenna Microsoft Word Help 3 May 12th 08 06:30 AM
Copying from Word to GMAIL doubles lines between paragraphs? mountain Microsoft Word Help 2 May 6th 08 05:05 PM
GMAIL INVITATION Michele Bonetti Mailmerge 0 February 23rd 06 12:20 PM


All times are GMT +1. The time now is 04:09 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright 2004-2021 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.