Exportin email addresses

G

George

Hello friends,

I have a table (tbl_Members) and within that table i have a field called
MembersEmail. I have more than 150 records. (Access 2003)

I need a way to export all those email addresses, each one separated by a
semicolon, into a text file. Later on I may just copy/paste all these into a
new email.

How can this be done? Any help will be highly appreciated.

Thanking you in advance,

GeorgeCY
 
P

Piet Linden

Hello friends,

I have a table (tbl_Members) and within that table i have a field called
MembersEmail.  I have more than 150 records. (Access 2003)

I need a way to export all those email addresses, each one separated by a
semicolon, into a text file.  Later on I may just copy/paste all these into a
new email.

How can this be done?  Any help will be highly appreciated.

Thanking you in advance,

GeorgeCY

child's play.

Public Sub ExportToText()
Dim rsEMails As DAO.Recordset
Dim intFileNo As Integer
Dim strEMailList As String

Set rsEMails = DBEngine(0)(0).OpenRecordset("SELECT EMailAddresses
FROM Student WHERE EMailAddresses IS NOT NULL", dbOpenForwardOnly)

'--loop through recordset, writing records to file.
Do Until rsEMails.EOF
If Len(strEMailList) = 0 Then
strEMailList = rsEMails.Fields("EMailAddresses")
Else
strEMailList = strEMailList & ";" & rsEMails.Fields
("EMailAddresses")
End If
rsEMails.MoveNext
Loop

'--open file, write data string to it.
intFileNo = FreeFile
Open "AddressFile.txt" For Output As #intFileNo
Print #intFileNo, strEMailList
'--close text file
Close #intFileNo

'--clean up recordset
rsEMails.Close
Set rsEMails = Nothing

Debug.Print "Done!"
End Sub
 
W

Wayne-I-M

Create a query with just your email address'
Right click the query
Select export
Select Text File from the option box
Select Dilimited from the 1st option
Select Semicolon and Text qulifier = None from the 2nd option
Finish
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top