Dates to text in a script 
Author Message
 Dates to text in a script

I am using the following script to send e-mail with an attached file once a
week to a contact.
It works fine.
(Many thanks to Michael Harris who sent it to me.)

Now I would like to be able to insert the date into the maiMail.Subject and
into the maiMail.Body so that each email would be uncontestably
date-specific.
How do I go about picking up the today's-date and now-time ?
I would like the maiMail.Body to read something like
"This DataFile dated 23 July 1999 replaces all previous versions."
and the maiMail.Subject to read
"For Harry. DataFile Update from The Company - 23 July 1999 "

'Start script
Set WSHShell = WScript.CreateObject("WScript.Shell")
    Set appOutl = Wscript.CreateObject("Outlook.Application")

    ' Set a reference to the MailItem object.
      Set maiMail = appOutl.CreateItem(0)

       ' Set  the recipient's address

       ' Add subject and body text.
        maiMail.Subject = "For Harry. DataFile Update from The Company"
        maiMail.Body = "This DataFile replaces all previous versions."
        maiMail.Attachments.Add("C:\Data \DataFile.CSV")

      ' Send the mail.
        maiMail.Send

    ' Close object references.
    Set appOutl = Nothing
    Set maiMail = Nothing
    Set recMessage = Nothing
'End script



Sun, 09 Dec 2001 03:00:00 GMT  
 Dates to text in a script
TheDate = Now()
s = Day(TheDate) & " " _
  & MonthName(Month(TheDate))  & " " _
  & Year(TheDate)
msgbox s

--
Michael Harris


|
| I am using the following script to send e-mail with an attached file once
a
| week to a contact.
| It works fine.
| (Many thanks to Michael Harris who sent it to me.)
|
|
| Now I would like to be able to insert the date into the maiMail.Subject
and
| into the maiMail.Body so that each email would be uncontestably
| date-specific.
| How do I go about picking up the today's-date and now-time ?
| I would like the maiMail.Body to read something like
| "This DataFile dated 23 July 1999 replaces all previous versions."
| and the maiMail.Subject to read
| "For Harry. DataFile Update from The Company - 23 July 1999 "
|
|
| 'Start script
| Set WSHShell = WScript.CreateObject("WScript.Shell")
|     Set appOutl = Wscript.CreateObject("Outlook.Application")
|
|     ' Set a reference to the MailItem object.
|       Set maiMail = appOutl.CreateItem(0)
|
|        ' Set  the recipient's address

|
|        ' Add subject and body text.
|         maiMail.Subject = "For Harry. DataFile Update from The Company"
|         maiMail.Body = "This DataFile replaces all previous versions."
|         maiMail.Attachments.Add("C:\Data \DataFile.CSV")
|
|       ' Send the mail.
|         maiMail.Send
|
|     ' Close object references.
|     Set appOutl = Nothing
|     Set maiMail = Nothing
|     Set recMessage = Nothing
| 'End script
|
|
|
|



Sun, 09 Dec 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Date - date = date

2. Compare date in form with date/time in form with date/time in database

3. Searching for Date in large text string

4. Text in string/date

5. Populating text boxes with date info

6. populate a text box with date to be sent to database

7. VBScript and Date or Text Functions??

8. how to write date modified into text file ?

9. Text, date and number formatting

10. questions on passing text parameter from server script to client script (some new findings)

11. Is there a Script Debugger or a good text editor for writing scripts

12. Text box text on new page text box

 

 
Powered by phpBB® Forum Software