A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Changing objItem.Body with formatting



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing RTF Body on MailItem Read event [email protected] Add-ins for Outlook 3 September 13th 06 08:30 PM
Automatic formatting doesn't scan message body? Wowbagger Outlook - General Queries 1 September 12th 06 05:13 PM
Create Folders Along with ObjItem.Move ? gamename Outlook and VBA 8 July 24th 06 07:21 PM
Changing the font body of an outlook task in vba Gary F Outlook and VBA 2 June 7th 06 09:20 PM
formatting LarryV Outlook - Installation 0 April 4th 06 07:31 PM


All times are GMT +1. The time now is 09:22 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.