Consulting

Results 1 to 2 of 2

Thread: insert Date/Time in body of message

  1. #1
    VBAX Expert TrippyTom's Avatar
    Joined
    Jul 2005
    Location
    New York, NY (USA)
    Posts
    556
    Location

    insert Date/Time in body of message

    Is there some simple code I can use to put in the current date/time (static, does not change when the message is read) in the body of a message?

    I have created a template that I use to send out to clients that is intended to give them an ETA for their project completion. It would be nice if the template automatically put in the date/time when I open the template or send it off.

  2. #2
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    You could use the Item_Send event (open the VBE - Alt F11, above the code window, select "Application" from the left drop-down and "Item_Send" from the right one)
    The following code will add the current date & time at the start of the message[VBA]Item.Body = Format(Now, "dd MMM yyyy - hh:mm") & vbLf & Item.Body[/VBA]This will happen to every mail you send, so I think you'll want to wrap it in an If... Then/End If and test to see if the item is based on your template - how you do that will depend on how you've set that up
    K :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •