View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default RECORD SENT EMAIL

Hi Pam

Use the below proceudre ...WritetoLog..

Sub Macro()
'your code to send mail starts here
'
'your code to send mail ends here

Call WritetoLog(Environ("Username"), "Pam")
'you can replace the username with a variable
'strTo is the mailTo as a string variable

End Sub

Replace the sheet name ...
Sub WritetoLog(strUser As String, strTo 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) = strUser
ws.Range("B" & lngRow) = strTo
ws.Range("C" & lngRow) = Now
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Pam M" wrote:

I have a macro that enables the user to send an email from an excel
application. It is attached to a button. Is there a way to add code that
would populate a cell each time that button is used (or the macro is run)? I
would like it to add a line each time, not write it over. I want it to
capture the username, which I have as a function in VB, date, time, and To:.