Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select a whole column and e-mail

Status
Not open for further replies.

MagicalDean

Technical User
Feb 16, 2005
61
GB
How can I get VBA to select the entire E-Mail column in a table called UserDetails, put them in the correct format and then use it as the Cc: in an e-mail? The e-mail programme is Outlook if that helps). Any assistance is greatly apprechiated!
 
Have you looked at the SendObject Method?
Alternatively, if the cc bit is not essential, MSWord mailmerge works quite well.
 
The bit I really can't work out is how to get the whole of the E-Mail column in an array or whatever is needed in a form that I can use for the method...? Any ideas anyone? Its got me stumped :'(
 
Sorry, but I do not understand what you mean. Why do you need the column in an array? Surely what is needed is to page through a recordset with a Do While ... Loop? What am I missing? Perhaps you could include an example from the column you wish to use?

And just to finish ???
 
I read somewhere that it needed to be in an array...I could be wrong. The column would contain just the E-Mail for each user listed, the table being called UserDetails
 
If you look up SendObject in Access VB help, you will find some of this stuff. Also check out
thread707-322006 on this site.
Code:
Sub SendEmails()
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("Employees")

Do While Not rs.EOF
DoCmd.SendObject acSendTable, "Employees", acFormatXLS, _
    "" & rs!email & "", "" & rs!cc & "", , _
    "Current Spreadsheet of Employees", , True
rs.MoveNext
Loop
End Sub
 
Ahhh, cool :) Ta

Sorry for the long reply, but that was a great help! Ta :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top