View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default include date and time in email subject line

I just did this last week. I can't test it now, but as I recall it was
something like this:

.Subject = "This is the Subject line" & " " & Format(Now, "hh:mm:ss") & " "
& Format(Date, "dd/mm/yyyy")

.Subject = "This is the Subject line" & " " & Now() & " " & Date()

Something along those lines.
You need the ampersand; that's the key.


Regards,
Ryan---

--
RyGuy


"pswanie" wrote:

i use this code from ron's

how can i get the current date and time from the system to go in the subject
line?
----------------------------------------------------------------------------------------------
i need something like

.Subject = "inventory movement for 13/02/08 21:08pm"

-----------------------------------------------------------------------------------------------

Set rng = Sheets("data capture").UsedRange

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.HTMLBody = RangetoHTML(rng)
.display 'or use .Send
End With
On Error GoTo 0

With Application
.EnableEvents = True
.ScreenUpdating = True
End With