Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
email hyperlink - cell value in subject line boustrophedon Excel Discussion (Misc queries) 19 April 21st 23 06:12 PM
Changing subject line in email tanyhart[_6_] Excel Programming 4 June 7th 06 04:34 PM
Subject line in email defaults to workbook file name. swellett Excel Discussion (Misc queries) 0 March 17th 06 04:55 PM
How do I include cell data in subject line of email address/hyperl gvinnola Excel Worksheet Functions 1 November 18th 04 02:36 AM
Code to Email with UNC in subject line Sandy[_3_] Excel Programming 1 July 14th 03 02:10 PM


All times are GMT +1. The time now is 04:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"