Solved

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

Posted on 2003-10-22
3
643 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 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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Introduction to Processes

729 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