Please find the below comments aganist your points and the modified code
Sub Macro()
'your code to send mail starts here
'
'your code to send mail ends here
Dim strReceipients As String
Dim strBody As String
strReceipients = <to string>
strBody = Range("A1").Text
Call WritetoLog(strReceipients, Range("A1"))
End Sub
Sub WritetoLog(strTo As String, strBody As String)
Dim ws As Worksheet, lngRow As Long
Set ws = Worksheets("Sheet1")
lngRow = ws.Cells(Rows.Count, "A").End(xlUp).Row + 1
ws.Range("A" & lngRow) = <call your function here>
ws.Range("B" & lngRow) = strTo
ws.Range("C" & lngRow) = strBody
ws.Range("D" & lngRow) = Now
End Sub
If this post helps click Yes
---------------
Jacob Skaria
Pam M said:
Jacob; Very cool! I know enough to be dangerous and am self teaching here.
Couple of questions:
1) In WritetoLog where you have Environ "username", --is that calling my
function for username? If so, if my function is actually called
UserNameWindows, I'm thinking I would replace that with my function name?
Sure, you can do that; can call the function within the procedure...
2) I tested multiple addresses and code picks up only one. How can I
include all addressees in a string?
If you have the to addresses as a string pass that to strReceipients or
replace that with your variable..If you have it in a range you can loop and
store that to a variable
3) To capture every user who uses the button, what would my variable be in
place of Pam? An *?
Pam was in place of strTo....In the modified one pass the receipients to the
variable
4) If I also wanted to include the body, would I include strBody as string
and add range D?
Check the modified code..
Thanks so much for your speedy response and your help. Pam
You are always welcome..