![]() |
include date and time in email subject line
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 |
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 |
include date and time in email subject line
thanx...
worked like a charm.. "ryguy7272" wrote: 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 |
All times are GMT +1. The time now is 02:02 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com