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 - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How to programaticaly use Bold or Colored Text in Task Body



 
 
Thread Tools Search this Thread Display Modes
  #11  
Old November 6th 08, 03:35 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to programaticaly use Bold or Colored Text in Task Body

I didn't do the conversion from OLE_COLOR to RGB values but since black is
&H0 I'd imagine that 5 and 2 are just shades of black. Try setting the color
to something different like &HFF (or 255 which is red).

The message you're getting indicates from the applied test that RTFEditor is
either nothing or the editor type isn't RTF, that test really should be
before any attempts to use RTFEditor. What version of Outlook is this? Have
you tried using Item.GetInspector to set the SafeInspector.Item property
instead of using ActiveInspector?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"bbnimda" wrote in message
...
Sorry, O forgot to add a piece of code [ TXT buton function ]
I put the RTFEditor function in a button, because I still didn't found the
right sentence to use it the [ Function Item_Open() ]

1) I didn't found the way to apply the policy modification to the body
task
2) the selected text became Bold and italic but stay black
3) I still get the message "This sample only works for the RTF Editor"



Sub TXT_click()

set sInspector = CreateObject("Redemption.SafeInspector")

sInspector.Item = Application.ActiveInspector

Set RTFEditor = sInspector.RTFEditor

RTFEditor.SelAttributes.Style.Bold = TRUE

RTFEditor.SelAttributes.Style.italic = TRUE

RTFEditor.SelAttributes.Color = 5

RTFEditor.SelAttributes.Color = 2

if (RTFEditor is Nothing) or (sInspector.EditorType olEditorRTF) Then

MsgBox "This sample only works for the RTF Editor" &vblf&
Item.GetInspector.EditorType

Else

RTFEditor.SelAttributes.Style.Bold = TRUE

End If

end sub


Ads
  #12  
Old November 7th 08, 08:53 AM posted to microsoft.public.outlook.program_forms
bbnimda
external usenet poster
 
Posts: 94
Default How to programaticaly use Bold or Colored Text in Task Body

Hello Ken

Here is my working code , If I do nothing else my formated text is kept
=================================
Function Item_Open()
Set myFolder = Application.ActiveExplorer.CurrentFolder
Id = myfolder.items.count
CurUsr = application.GetNameSpace("MAPI").CurrentUser
If Item.LastModificationTime #1/1/4501# Then
NewTask = 0
Long0 = 0
else
NewTask = 1
Long0 = len(body)
end if
If Not (Application.ActiveInspector Is Nothing) Then
Set sInspector = CreateObject("Redemption.SafeInspector")
sInspector.Item = Application.ActiveInspector
Set RTFEd = sInspector.rtfeditor
If Not (RTFEd Is Nothing) Then
Set RTA = RTFEd.SelAttributes
RTFEd.SelStart = intStart + longueur
RTA.Style.Bold = True
RTA.Style.italic = true
RTA.Color = 9709060
if long0 0 then
sInspector.SelText = " " & vbLf & vbLf & vbLf & CurUsr & "
le "& date()& vbCrLf
else
sInspector.SelText = CurUsr & " "& date()& vbCrLf
end if
RTA.Style.Bold = false
RTA.Style.italic = false
RTA.Color = 1
end if
end if
End Function
=================================

but if I add something like
body = body & vblf&"closed " for example closed is added at the end of my
task body and all the task body text (include the text in bold or colored)
became simple text and black

tks for your help


"Ken Slovak - [MVP - Outlook]" a écrit dans le message
de news: ...
I didn't do the conversion from OLE_COLOR to RGB values but since black is
&H0 I'd imagine that 5 and 2 are just shades of black. Try setting the
color to something different like &HFF (or 255 which is red).

The message you're getting indicates from the applied test that RTFEditor
is either nothing or the editor type isn't RTF, that test really should be
before any attempts to use RTFEditor. What version of Outlook is this?
Have you tried using Item.GetInspector to set the SafeInspector.Item
property instead of using ActiveInspector?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"bbnimda" wrote in message
...
Sorry, O forgot to add a piece of code [ TXT buton function ]
I put the RTFEditor function in a button, because I still didn't found
the right sentence to use it the [ Function Item_Open() ]

1) I didn't found the way to apply the policy modification to the body
task
2) the selected text became Bold and italic but stay black
3) I still get the message "This sample only works for the RTF Editor"



Sub TXT_click()

set sInspector = CreateObject("Redemption.SafeInspector")

sInspector.Item = Application.ActiveInspector

Set RTFEditor = sInspector.RTFEditor

RTFEditor.SelAttributes.Style.Bold = TRUE

RTFEditor.SelAttributes.Style.italic = TRUE

RTFEditor.SelAttributes.Color = 5

RTFEditor.SelAttributes.Color = 2

if (RTFEditor is Nothing) or (sInspector.EditorType olEditorRTF) Then

MsgBox "This sample only works for the RTF Editor" &vblf&
Item.GetInspector.EditorType

Else

RTFEditor.SelAttributes.Style.Bold = TRUE

End If

end sub




  #13  
Old November 7th 08, 03:08 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to programaticaly use Bold or Colored Text in Task Body

You have to add what you want added using correct RTF formatting or else
you're rewriting the body as do add the new text. Add what you want using
RTFEditor.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"bbnimda" wrote in message
...
Hello Ken

Here is my working code , If I do nothing else my formated text is kept
=================================
Function Item_Open()
Set myFolder = Application.ActiveExplorer.CurrentFolder
Id = myfolder.items.count
CurUsr = application.GetNameSpace("MAPI").CurrentUser
If Item.LastModificationTime #1/1/4501# Then
NewTask = 0
Long0 = 0
else
NewTask = 1
Long0 = len(body)
end if
If Not (Application.ActiveInspector Is Nothing) Then
Set sInspector = CreateObject("Redemption.SafeInspector")
sInspector.Item = Application.ActiveInspector
Set RTFEd = sInspector.rtfeditor
If Not (RTFEd Is Nothing) Then
Set RTA = RTFEd.SelAttributes
RTFEd.SelStart = intStart + longueur
RTA.Style.Bold = True
RTA.Style.italic = true
RTA.Color = 9709060
if long0 0 then
sInspector.SelText = " " & vbLf & vbLf & vbLf & CurUsr &
" le "& date()& vbCrLf
else
sInspector.SelText = CurUsr & " "& date()& vbCrLf
end if
RTA.Style.Bold = false
RTA.Style.italic = false
RTA.Color = 1
end if
end if
End Function
=================================

but if I add something like
body = body & vblf&"closed " for example closed is added at the end of
my task body and all the task body text (include the text in bold or
colored) became simple text and black

tks for your help


 




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
Calendar task pad dates not bold Alex Hawkins Outlook - Calandaring 9 January 21st 08 12:08 PM
body text always in bold martin shaw Outlook - General Queries 4 December 29th 07 08:54 AM
Calendar Bold Text Silver Outlook - Calandaring 1 January 8th 07 01:11 PM
Outlk 2k3 script: Tab in body Task "space to separate text" news.microsoft.com Outlook and VBA 1 November 17th 06 03:13 PM
New messages and bold text History Fan Outlook Express 8 July 2nd 06 02:23 AM


All times are GMT +1. The time now is 01:49 PM.


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.