Export email address to notepad?

Benny Wong

Registered User.
Local time
Today, 11:02
Joined
Jun 19, 2002
Messages
65
Hello All,
I am using Access 2000. Currently I have created my queries to get all the email addresses. I have a button that I can click to run the query to display all the email address. What I would like to have done is the ablility to export all the email address into notepad but in this format. Here is an example:
johndoe@anywhere.com; adameve@somewhere.com; etc...
The reason I need it exported out into notepad and in this format is to let the user copy and paste it into Microsoft Outlook and mass email their clients. Thanks in advance for any suggestions or advice.
 
Here is what I use to query all of my email addresses and send them to the clipboard,
then I can easily paste them into the To: section of my email. I have a text box on the
form named tbEmailNames. This code will seperate each address with a semi colon.

Code:
Private Sub bCopyEmailNames_Click()
On Error GoTo Err_bCopyEmailNames_Click
    
    Dim MyDb As Database
    Dim sNames As String
    Dim sEmailNames As String
    Dim rEmailNames As Recordset
    
    Set MyDb = CurrentDb()
    
    DoCmd.SetWarnings False
    
    sNames = ""
    'My table tContacts has the email addresses in field EmailAddress 
    sEmailNames = "SELECT EmailAddress From tContacts;"
    
    Set rEmailNames = MyDb.OpenRecordset(sEmailNames)
        rEmailNames.MoveFirst
    Do Until rEmailNames.EOF = True
        sNames = sNames & "; " & rEmailNames!EmailAddress
    If Not rEmailNames.EOF Then rEmailNames.MoveNext
    
    Loop
    
    rEmailNames.Close
    
    Me.tbEmailNames.Value = sNames
    Me.tbEmailNames.SetFocus
    
    DoCmd.RunCommand acCmdCopy
    
    Beep
    
    MsgBox "You have just copied all the current Email addresses from this database
 to the Clipboard." & vbCrLf & vbLf & "Now you can Paste (Ctrl + V) the Email Names
 into the To: section of a new Email message."
    
    sNames = ""
    sEmailNames = ""
    tbEmailNames = ""
    Set MyDb = Nothing
    Set rEmailNames = Nothing
    
    DoCmd.SetWarnings True
    
Exit_bCopyEmailNames_Click:
    Exit Sub
    
Err_bCopyEmailNames_Click:
    MsgBox Err.Number, Err.Description
    Resume Exit_bCopyEmailNames_Click
    
End Sub
HTH
 

Users who are viewing this thread

Back
Top Bottom