Modification to Time and Date stamp needed 
Author Message
 Modification to Time and Date stamp needed

I only know enough about VBA to be dangerous :-)

The following code stamps ok but in the message body I want to stamp then
write text then stamp over time.
Problem is the second and subsequent stamps go to the top of the message
body.

I would also like the cursor to be at the end of the time stamp or on the
next line not at the beginning of the stamp as it currently does..

Third what do I need to do to remove seconds?

Sub StampDateOnCurrentItem()
    Dim objApp As Application
    Dim objItem As Object ' note late binding

    Set objApp = CreateObject("Outlook.Application")
    Set objItem = objApp.ActiveInspector.CurrentItem
    objItem.Body = Now() & vbCrLf & vbCrLf & objItem.Body
    objItem.Save

    Set objApp = Nothing
    Set objItem = Nothing
End Sub

Thanks

Ian



Sun, 02 May 2004 22:28:57 GMT  
 Modification to Time and Date stamp needed
Try:

objItem.Body = objItem.Body & vbCrLf & vbCrLf & _
        Date() & " " & FormatDateTime(Now(), vbShortTime)

You can't control the cursor position.

--
Sue Mosher, Outlook MVP
   Outlook and Exchange Solutions
   at http://www.slipstick.com


Quote:
> I only know enough about VBA to be dangerous :-)

> The following code stamps ok but in the message body I want to stamp then
> write text then stamp over time.
> Problem is the second and subsequent stamps go to the top of the message
> body.

> I would also like the cursor to be at the end of the time stamp or on the
> next line not at the beginning of the stamp as it currently does..

> Third what do I need to do to remove seconds?

> Sub StampDateOnCurrentItem()
>     Dim objApp As Application
>     Dim objItem As Object ' note late binding

>     Set objApp = CreateObject("Outlook.Application")
>     Set objItem = objApp.ActiveInspector.CurrentItem
>     objItem.Body = Now() & vbCrLf & vbCrLf & objItem.Body
>     objItem.Save

>     Set objApp = Nothing
>     Set objItem = Nothing
> End Sub

> Thanks

> Ian



Mon, 03 May 2004 01:05:43 GMT  
 Modification to Time and Date stamp needed
Thanks Sue.

Worked fine.


| Try:
|
| objItem.Body = objItem.Body & vbCrLf & vbCrLf & _
|         Date() & " " & FormatDateTime(Now(), vbShortTime)
|
| You can't control the cursor position.



Mon, 03 May 2004 10:05:43 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Need to read file Time and/or Date stamp

2. File Modification Date/Time - grabbing and setting

3. Date/time of last modification for an URL

4. Date and Time Stamp for a Field Being Modified

5. Return File Date Time stamp

6. Access 7.0/8.0 (Win95) - How to retrieve a file's date/time stamp

7. (Q) Help with SelectDir and Date/Time stamp

8. Help! Object date/time stamp screw-up

9. How to get Server date/time stamp?

10. Saving date/time stamp of text file

11. Creating a Global Date/Time Stamp feature for forms

12. Misleading Date/Time Stamp on mdb

 

 
Powered by phpBB® Forum Software