include date and time in email subject line

P

pswanie

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 = "(e-mail address removed)"
.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
 
R

ryguy7272

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---
 
P

pswanie

thanx...

worked like a charm..



ryguy7272 said:
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---
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top