Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook - General Queries (http://www.outlookbanter.com/outlook-general-queries/)
-   -   Select Text in body using Redemption (http://www.outlookbanter.com/outlook-general-queries/60812-select-text-body-using-redemption.html)

Michael Salz November 8th 07 07:20 PM

Select Text in body using Redemption
 
I am trying to select text within the body of an e-mail, click a button on a
toolbar and have the selected text appear in a message box.

I have implemented the SafeInspector class of Redemption and have
implemented the following code within the "Click" event handler function of a
toolbar button. It works great when I actually open the e-mail and select
the text. However, if I do not open the e-mail, but highlight the text in
the preview pane the Message Box pops up with no text. Thanks in advance.

Dim objoutlook As Outlook.Application = _Module.HostApplication

Dim sel As Outlook.Selection = objoutlook.ActiveExplorer.Selection



If sel.Count 0 Then

Dim selobject As Object = Nothing

selobject = sel.Item(1)

If TypeOf selobject Is Outlook.MailItem Then

Dim mailitem As Outlook.MailItem = TryCast(selobject, Outlook.MailItem)

Dim editor As Outlook.Inspector = mailitem.GetInspector

Dim sinspector As Redemption.SafeInspector = New Redemption.SafeInspector

sinspector.Item = mailitem.GetInspector

MsgBox(sinspector.SelText)

If TypeOf selobject Is Outlook.MailItem Then

Dim mailitem As Outlook.MailItem = TryCast(selobject, Outlook.MailItem)

Dim editor As Outlook.Inspector = mailitem.GetInspector

Dim sinspector As Redemption.SafeInspector = New Redemption.SafeInspector

sinspector.Item = mailitem.GetInspector

MsgBox("You have selected: " & sinspector.SelText)




All times are GMT +1. The time now is 06:56 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-2006 OutlookBanter.com