Changing objItem.Body with formatting

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using the code below (modified from code found on outlookcode.com) to add
a date/time stamp to my Jounral entries in Outlook 2003 SP2 (I use a single
Journal entry for notes for each project so I want the date/time added
whenever I need it). The problem is that this code wipes out the formatting
of the text. Saving the existing formatting is part one of my problem. Is
there any (relatively simple) way to do it?

Assuming that I can save the formatting, the second part of my problem would
be how to make the text that I am entering via VBA bold.

Can anyone out there lend me a hand?

Thanks,
-Steve

Sub StampJournalTop()

Dim objItem As Object
Dim objNS As NameSpace

Set objNS = Application.GetNamespace("MAPI")
Set objItem = Application.ActiveInspector.CurrentItem
If objItem.Class = olJournal Then
objItem.Body = Format(Now(), "dd mmmm yyyy, h:m AMPM") & ": " &
vbCrLf & vbCrLf & objItem.Body
End If

Set objItem = Nothing
Set objNS = Nothing

End Sub
 
So much for thinking that VBA in Outlook might be anywhere near as easy as it
is in Word. Oh well. Thanks for the help. I'm thinking that I'm not near
motivated enough to tackle that.

-Steve
 
Back
Top