Thread: [Solved] Mailmerge
View Single Post
 
Old 12-01-2011, 07:22 AM
wowow wowow is offline Windows 7 32bit Office 2007
Novice
 
Join Date: Nov 2011
Posts: 17
wowow is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Hi wowow,

The link I posted has all you need - a link to the basic macro, plus the code (and instructions) to modify it for adding the CC stuff.
Thank macropod.

I just repalce a part of the code of mail merge with attachment by the code that uses to allows CC and BCC in mail merge as the follows:

I replaced

Code:
    With oItem
        .Subject = mysubject
        .Body = Source.Sections(j).Range.Text
        Set Datarange = Maillist.Tables(1).Cell(j, 1).Range
        Datarange.End = Datarange.End - 1
        .To = Datarange
        For i = 2 To Maillist.Tables(1).Columns.Count
            Set Datarange = Maillist.Tables(1).Cell(j, i).Range
            Datarange.End = Datarange.End - 1
            .Attachments.Add Trim(Datarange.Text), olByValue, 1
        Next i
        .Send
    End With
by

Code:
With oItem
.Subject = mysubject
.body = ActiveDocument.Content
Set Datarange = Maillist.Tables(1).Cell(Counter, 1).Range
Datarange.End = Datarange.End - 1
.To = Datarange
For i = 2 To Maillist.Tables(1).Columns.Count
Set Datarange = Maillist.Tables(1).Cell(Counter, i).Range
Datarange.End = Datarange.End - 1
.Attachments.Add Trim(Datarange.Text), olByValue, 1
Next i
.CC = "Firstemailaddress; secondemailaddress"
.BCC = "Firstemailaddress; secondemailaddress"
.Send
End With
Is it right?

Now I wonder how to use with the new code. Should I use VBA editor to embed the code in the letter that is to generate and send multiple mails or I make a separate marcro to run when I open the letter to merge emails?

Thanks.
Reply With Quote