emailing range people

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Emailing a range of people

Emailing a range of people

resolvedResolved · High Priority · Version 2007

Louisa has attended:
Excel VBA Intro Intermediate course
Excel VBA Advanced course

Emailing a range of people

I have googled and googled but no luck.

I am trying to email a list of people (which will change depending on the client).

The plan is to use find to find the row the client is on and this will define the range.

How do I then use the range in the to section of my email the code for which currently looks like this. This the to section you can add as many email addresses as needed.

On Error Resume Next
With OutMail
.To = "louisa.thompson@towertradinggroup.com"
.CC = ""
.BCC = ""
.Subject = strCell2 & " Recap " & strDate
.HTMLBody = RangetoHTML(rng)
.display 'does not send this just produces an email to review


I was thinking I need a for each loop but that's as far as I got.

For each rcell3 in remail

.....


Thanks in advance.

Edited on Mon 8 Jul 2013, 09:50

RE: Emailing a range of people

Hi Louisa

Thanks for getting in touch, good to hear from you.

There's a really good example on a site which I think was brought up during our training:

http://www.rondebruin.nl/win/s1/outlook/bmail7.htm

Which deals with a very similar scenario. I've adapted his code and attached it here.

It runs through every cell in column B and uses that as the email address.

You should be able to adapt the attachment to your data. Give this a try and let me know how you get on.

Kind regards

Gary Fenn
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

Attached files...

GF Mail Send.xlsm

RE: Emailing a range of people

I had found that example as I usually use Ron de Bruin for emails. But these only have one recipient in each email. I have multi-recipients which are variable and that is the bit I am struggling with. Its important that all recipients are on each email if that makes sense so people can see who has been copied in.

My normal emails have fixed recipients and can do those easily.

RE: Emailing a range of people

I have had an idea. I would concatenate them to produce a string (with commas in the middle).

Will let you know if that works.

Edited on Mon 8 Jul 2013, 15:21

RE: Emailing a range of people

Hi Louisa

Thanks for clarifying. If you are looking to combine multiple email address in the To: field you need to concatenate them with the semi-colon character (;). With this you could use a simple Do Until loop to go through your range to concatenate them into one string. Something like this:

Dim AllAddresses as String

...

Do Until <condition>

AllAddresses = AllAddresses & ";" & cell.Value

Loop

You could then use

.To = AllAddresses

Kind regards

Gary Fenn
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

RE: Emailing a range of people

Hi,

I cheated and used concatenate in excel. I am not sure why I didn't think of it before. Anyway it seems to work all ok.

Thanks again.

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Move or Highlight Cells

Use any of your movement keys, cursor, Home, End, PgUp or PgDn to highlight cells rows or columns by holding down the Shift key as you move.

Use in combination with the Ctrl key for quicker movements.

View all Excel hints and tips


Server loaded in 0.08 secs.