Solved

visual basic + excel - sending emails to mulitple address stored in cells

Posted on 2003-10-22
3
627 Views
Last Modified: 2010-04-17
hey

once again more problems sending emails using visual basic (though a different program this time)

the guitarist in my band wants an easy to use mailing list. now there are plently of eaier options for doing this.. but i decided to try writing one using VB and Excel, just to see if i could really...

... i cant! or at least, im having trouble, hense the reason im here!

basically email addresses are stored in the individual cells of a column (range("a1") downwards)

at the moment, im using this code, kindly suggest by Bruintje in one of my previous questions to send the emails:

Dim iOutlook As Object
Dim myApp As Object
Set iOutlook = CreateObject("Outlook.Application")
Set myApp = iOutlook.CreateItem(0)
myApp.To = (blank)
myApp.Subject = "My Subject"
'myApp.Attachments.Add "C:\file.txt" '<-uncomment to attach a file
myApp.Body = "ello"
'myApp.send
Set myApp = Nothing
Set iOutlook = Nothing
End Sub

however, i want to know if it is possible to have the email sent to all the addresses stored in the column. i can do the address in the first cell of the column:

yApp.To = range("a1").value

but i havnt got a clue how to go about getting other email address into the "yApp.To" section.

is it possible? can the experts understand my crude explanation of my problem? will toast ever fall butter side up? only time will tell :)

thanks,

dave xXxx
0
Comment
Question by:paddock
3 Comments
 
LVL 5

Expert Comment

by:fantasy1001
ID: 9603290
if you know exactly how many email in the column then

yApp.To = range("a1").value & ";" & range("a2").value & ";" & range("a3") & ... continue here
0
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 125 total points
ID: 9603909
Dim x as string
int i as integer

i = 0
while Cells(i, "A").Value <> Empty
 x = x + Cells(i,"A").Value +"; "
Wend

myApp.To = x

note: It runs until there's a blank, but I would figure you had the list sorted.  I would also recommend doing the myApp.BCC to eliminate publishing everyone's e-mail addresses to each other.  Good luck!
0
 

Author Comment

by:paddock
ID: 9605313
thankee most kindly sir!

doesnt quite work, but i think thats my own inadequacies showing through lol

il keep working on it, it does look like exactly what i need!

as for your suggestion fantasy1001, although that would have worked, there are two problems:

1) the number of people on the list are always changing (people subscribe, unsubscribe) and seeing how the recipicant of the program knows less VB than myself, he wouldnt know how to adjust the code accordingly

2) there is absolutly no way that im going to sit there and type out all the cell refrences! i really am that lazy:)

but thank you for your advice

dave xXxx
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
firstswap challenge 20 82
C# Error - Add Failed 12 93
c++ reading data from file into two dimensional array 3 117
Full Screen problem when auto scale IFRAME 2 101
I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
A short article about a problem I had getting the GPS LocationListener working.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question