Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Simple Question on SafeInspector's RTEEditor

14 views
Skip to first unread message

survi...@gmail.com

unread,
Jul 25, 2006, 12:39:53 PM7/25/06
to
Let's say I have this code, which uses the Redemption SafeInspector
library:

Set sInspector = CreateObject("Redemption.SafeInspector")
sInspector.Item = Application.ActiveInspector
If sInspector.EditorType = olEditorRTF Or sInspector.EditorType =
olEditorWord Then
Set RTFEditor = sInspector.RTFEditor
RTFEditor.SelAttributes.Name = "Courier New"
RTFEditor.SelAttributes.Size = 8
' here's the question...
' RTFEditor.RTFSelText = ""
End If

...and then there are bunch of calls like

sInspector.SelText = "Some string"

Now, what I'm finding is that "Some string" prints out in whatever
font/size the Outlook email editor is already using. On the other
hand, if I uncomment that RTFEditor.RTFSelText="" line, then subsequent
calls to sInspector.SelText are in the chosen font/size.

Is there something I'm missing here (no surprise!) or is there a
different way of outputting "Some string" I should be using...? This
is Outlook 2003, if that matters.

Thanks!

-S.

Dmitry Streblechenko

unread,
Jul 25, 2006, 5:04:38 PM7/25/06
to
Why not try first to set the SelText property, and only then set the font
attributes?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

<survi...@gmail.com> wrote in message
news:1153845593.5...@m73g2000cwd.googlegroups.com...

survi...@gmail.com

unread,
Jul 25, 2006, 6:47:27 PM7/25/06
to
Dmitry Streblechenko wrote:
> Why not try first to set the SelText property, and only then set the font
> attributes?

Spasiba - ya nis nyiyoo - ya tolka neemnoga panamayoo VBA ;)

Unfortunately, my VBA is about as good as my Russian. Set the SelText
property of...what? I'm just going off the examples on your site -

BTW, the user isn't selecting anything. I'm just trying to paste some
RTF formatted text at the curosr when the macro is invoked.

And in fact, I've now found some cases where my earlier example does
not work perfectly...what is the canonical way to insert text at the
cursor in an RTF-formatted way?

Thanks,

-S.

Dmitry Streblechenko

unread,
Jul 26, 2006, 2:25:20 PM7/26/06
to
Sorry, I meant RTFSelText:

Set RTFEditor = sInspector.RTFEditor
RTFEditor.RTFSelText = "<your RTF formatted text here>"


RTFEditor.SelAttributes.Name = "Courier New"
RTFEditor.SelAttributes.Size = 8

Dmitry Streblechenko (MVP)


http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

<survi...@gmail.com> wrote in message
news:1153867647.4...@s13g2000cwa.googlegroups.com...

andrew...@gmail.com

unread,
Jul 26, 2006, 4:19:44 PM7/26/06
to
Dmitry Streblechenko wrote:
> Sorry, I meant RTFSelText:
>
> Set RTFEditor = sInspector.RTFEditor
> RTFEditor.RTFSelText = "<your RTF formatted text here>"
> RTFEditor.SelAttributes.Name = "Courier New"
> RTFEditor.SelAttributes.Size = 8

This code::

Set sInspector = CreateObject("Redemption.SafeInspector")
sInspector.Item = Application.ActiveInspector

If sInspector.EditorType = olEditorRTF Then
MsgBox ("Sorry, you're not in RTF")
Exit Sub
end if
Set RTFEditor = sInspector.RTFEditor
RTFEditor.RTFSelText = "Here is my RTF Text"


RTFEditor.SelAttributes.Name = "Courier New"
RTFEditor.SelAttributes.Size = 8

sInspector.SelText = "Here is my SelText"

prints

Here is my SelText

in the correct formatting...but it doesn't print "Here is my RTF Text".
It also works ("Here is my SelText" is printed in the correct
formatting) if the the RTFEditor.RTFSelText is set to ""

I'm just not sure it's supposed to be that way ;)

-S.

Dmitry Streblechenko

unread,
Jul 26, 2006, 4:46:19 PM7/26/06
to
I am not sure I understand: the last change wins, i.e. you are supposed to
get "Here is my SelText", *not* "Here is my RTF Text".
Did you expect anything else? Why do you set the sInspector.SelText property
after you set RTFEditor.RTFSelText?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

<andrew...@gmail.com> wrote in message
news:1153945184.0...@75g2000cwc.googlegroups.com...

0 new messages