Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2003-10-22
3
Medium Priority
?
661 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 41

Accepted Solution

by:
Kyle Abrahams earned 500 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Six Sigma Control Plans

610 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