Exporting Email addresses

Eljefegeneo

Still trying to learn
Local time
Today, 11:58
Joined
Jan 10, 2011
Messages
902
I am sure there is an easy solution to my question, but I seem to be brain dead today. I have a table with names and email addresses. I want to be able to send out a bulk email to all the email addresses, that is, export the email addresses to the format:
Address1@abc.com; address2@abc.com; address3@bcd.com ; etc.
I’ve searched for an answer, but all seem to link the sending of emails to Outlook, etc. I don’t want to send individual emails or use a mail merge, just want to be able to export all the email addresses to a text document from which I can copy all the names in the above format and then send the email to them all as a bcc.
Thanks.
 
Do you know VBA?

Create a Query with all the Email Addresses you need.
Now use this Recordset and you could loop through it adding each record to a string separated by ";".
You could then use this string how you want, save to a Txt file, open Outlook etc
 
Well, yes I know some VBA, but I have never lopped through a record set. I think what you mean is for me to set a variable(or dim something to be the temporary record), then loop through the recordset, adding each new email address to the temporary record as one comes up. Then that temporary record with all the email addresses is saved as a text file. Saying that, no I have no idea how to do this.
The query just selects records by country and then the email address criteria is "not is null".
 
Yes something like that.

http://msdn.microsoft.com/en-us/library/office/ff820966.aspx

I've quickly amended the code from the above article, it's untested but should get you started.

Code:
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strEmails As String

Set dbs = CurrentDb

Set rst = dbs.OpenRecordset("SELECT email FROM tblA")

'Begin row processing
Do While Not rst.EOF
    
    strEmail = strEmail & ";" & rst.email
    rst.MoveNext
   
Loop

'Cleanup
rst.Close
Set rst = Nothing

Amend the SQL to match your Table and Fields.
 
Sorry I haven't replied sooner. I tried to use the above without success. I will post what I did and perhaps you can tell me what I am doing wrong.
 

Users who are viewing this thread

Back
Top Bottom