View Single Post
  #1  
Old July 17th 07, 01:08 AM posted to microsoft.public.outlook.program_vba
SteveH
external usenet poster
 
Posts: 12
Default Changing objItem.Body with formatting

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

Ads