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 get Selected Body message Text



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 31st 09, 10:19 AM posted to microsoft.public.outlook.program_forms
pasteface method crashing outlook[_2_]
external usenet poster
 
Posts: 8
Default How to get Selected Body message Text

Hi,

I need to handle an event whenever we select something in mail body. Can
anyone say how to handle this event and how to get selected text.

I'm developing an outlook add-in in ATL COM(VC++)

Regards
Kiran. S
Ads
  #2  
Old August 31st 09, 03:13 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to get Selected Body message Text

There is no such event in the Outlook object model. If you are using
WordMail you can get Inspector.WordEditor as a Word.Document object and use
the Word Object model for that. If you are using HTML then you would have to
use the IHTMLDocument object model.

--
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


"pasteface method crashing outlook"
oft.com wrote in message
...
Hi,

I need to handle an event whenever we select something in mail body. Can
anyone say how to handle this event and how to get selected text.

I'm developing an outlook add-in in ATL COM(VC++)

Regards
Kiran. S


  #3  
Old September 9th 09, 01:47 PM posted to microsoft.public.outlook.program_forms
pasteface method crashing outlook[_2_]
external usenet poster
 
Posts: 8
Default How to get Selected Body message Text

Thanks Ken,

I tried Word Object Model and tried to capture the WordEditor of an mail
item. But inspector-get_WordEditor() is giving null pointer.
Code:
CComQIPtrOutlook::_Inspector spInspector;

CComPtrMSWord::_Document spWordDoc;
CComPtrMSWord::Selection spWordSelection;
CComPtrMSWord::_Application spWordApp;

spMailItem-get_GetInspector(&spInspector);
CComPtrOutlook::_Application spApp;
spInspector-get_EditorType(&editType);
BSTR str;
VARIANT_BOOL vTemp;

spInspector-IsWordMail(&vTemp);

if(vTemp == VARIANT_TRUE)
{

spInspector-get_WordEditor((IDispatch**)&spWordDoc);

spWordDoc-get_Application(&spWordApp);
spWordApp-get_Selection(&spWordSelection);
spWordSelection-get_Text(&str);
}

Please let me know if any issue found.

Regards
Kiran. S



"Ken Slovak - [MVP - Outlook]" wrote:

There is no such event in the Outlook object model. If you are using
WordMail you can get Inspector.WordEditor as a Word.Document object and use
the Word Object model for that. If you are using HTML then you would have to
use the IHTMLDocument object model.

--
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


"pasteface method crashing outlook"
oft.com wrote in message
...
Hi,

I need to handle an event whenever we select something in mail body. Can
anyone say how to handle this event and how to get selected text.

I'm developing an outlook add-in in ATL COM(VC++)

Regards
Kiran. S



  #4  
Old September 9th 09, 02:44 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to get Selected Body message Text

Where are you calling that code?

I've seen, especially in Outlook 2007, that WordEditor is null up until the
first Inspector.Activate() event. For example it's null in
Inspectors.NewInspector() because you're only getting a weak object
reference at that point.

If there is no Inspector then obviously there can't be a WordEditor object
since there is no Inspector.

--
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


"pasteface method crashing outlook"
oft.com wrote in message
...
Thanks Ken,

I tried Word Object Model and tried to capture the WordEditor of an mail
item. But inspector-get_WordEditor() is giving null pointer.
Code:
CComQIPtrOutlook::_Inspector spInspector;

CComPtrMSWord::_Document spWordDoc;
CComPtrMSWord::Selection spWordSelection;
CComPtrMSWord::_Application spWordApp;

spMailItem-get_GetInspector(&spInspector);
CComPtrOutlook::_Application spApp;
spInspector-get_EditorType(&editType);
BSTR str;
VARIANT_BOOL vTemp;

spInspector-IsWordMail(&vTemp);

if(vTemp == VARIANT_TRUE)
{

spInspector-get_WordEditor((IDispatch**)&spWordDoc);

spWordDoc-get_Application(&spWordApp);
spWordApp-get_Selection(&spWordSelection);
spWordSelection-get_Text(&str);
}

Please let me know if any issue found.

Regards
Kiran. S


  #5  
Old September 10th 09, 07:04 AM posted to microsoft.public.outlook.program_forms
pasteface method crashing outlook[_2_]
external usenet poster
 
Posts: 8
Default How to get Selected Body message Text


I'm call the code when we change mail item in main pane( BY handling
Command-Bar events). I'm able to get Inspector pointer but its WordEditor is
returning NULL. Using the below code to capture Inspector pointer.

Code:
CComPtr Outlook::SelectionspSelection;
m_pExplorer-get_Selection(&spSelection);

BSTR strname;
if(spSelection)
{

CComPtr IDispatch spItem;
CComVariant vCount(1);
spSelection-Item(vCount,&spItem);
if(!spItem)
return;
ATLASSERT(spItem);
CComQIPtr Outlook::_MailItem spMailItem(spItem);
ATLASSERT(spMailItem);

fprintf(fileptr,"[WSforOutlookMailItemSearching]-spMailItem::Success\r\n");
fflush(fileptr);

CComQIPtrOutlook::_Inspector spInspector;
spMailItem-get_GetInspector(&spInspector)
}

- Kiran. S

"Ken Slovak - [MVP - Outlook]" wrote:

Where are you calling that code?

I've seen, especially in Outlook 2007, that WordEditor is null up until the
first Inspector.Activate() event. For example it's null in
Inspectors.NewInspector() because you're only getting a weak object
reference at that point.

If there is no Inspector then obviously there can't be a WordEditor object
since there is no Inspector.

--
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


"pasteface method crashing outlook"
oft.com wrote in message
...
Thanks Ken,

I tried Word Object Model and tried to capture the WordEditor of an mail
item. But inspector-get_WordEditor() is giving null pointer.
Code:
CComQIPtrOutlook::_Inspector spInspector;

CComPtrMSWord::_Document spWordDoc;
CComPtrMSWord::Selection spWordSelection;
CComPtrMSWord::_Application spWordApp;

spMailItem-get_GetInspector(&spInspector);
CComPtrOutlook::_Application spApp;
spInspector-get_EditorType(&editType);
BSTR str;
VARIANT_BOOL vTemp;

spInspector-IsWordMail(&vTemp);

if(vTemp == VARIANT_TRUE)
{

spInspector-get_WordEditor((IDispatch**)&spWordDoc);

spWordDoc-get_Application(&spWordApp);
spWordApp-get_Selection(&spWordSelection);
spWordSelection-get_Text(&str);
}

Please let me know if any issue found.

Regards
Kiran. S



  #6  
Old September 10th 09, 02:04 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to get Selected Body message Text

You would need to display the Inspector.

--
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


"pasteface method crashing outlook"
oft.com wrote in message
...

I'm call the code when we change mail item in main pane( BY handling
Command-Bar events). I'm able to get Inspector pointer but its WordEditor
is
returning NULL. Using the below code to capture Inspector pointer.

Code:
CComPtr Outlook::SelectionspSelection;
m_pExplorer-get_Selection(&spSelection);

BSTR strname;
if(spSelection)
{

CComPtr IDispatch spItem;
CComVariant vCount(1);
spSelection-Item(vCount,&spItem);
if(!spItem)
return;
ATLASSERT(spItem);
CComQIPtr Outlook::_MailItem spMailItem(spItem);
ATLASSERT(spMailItem);

fprintf(fileptr,"[WSforOutlookMailItemSearching]-spMailItem::Success\r\n");
fflush(fileptr);

CComQIPtrOutlook::_Inspector spInspector;
spMailItem-get_GetInspector(&spInspector)
}

- Kiran. S


  #7  
Old September 11th 09, 04:34 AM posted to microsoft.public.outlook.program_forms
pasteface method crashing outlook[_2_]
external usenet poster
 
Posts: 8
Default How to get Selected Body message Text

can you tell me which event is needed to handle , when we select the text in
outlook 2007.

-Kiran.S

"Ken Slovak - [MVP - Outlook]" wrote:

You would need to display the Inspector.

--
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


"pasteface method crashing outlook"
oft.com wrote in message
...

I'm call the code when we change mail item in main pane( BY handling
Command-Bar events). I'm able to get Inspector pointer but its WordEditor
is
returning NULL. Using the below code to capture Inspector pointer.

Code:
CComPtr Outlook::SelectionspSelection;
m_pExplorer-get_Selection(&spSelection);

BSTR strname;
if(spSelection)
{

CComPtr IDispatch spItem;
CComVariant vCount(1);
spSelection-Item(vCount,&spItem);
if(!spItem)
return;
ATLASSERT(spItem);
CComQIPtr Outlook::_MailItem spMailItem(spItem);
ATLASSERT(spMailItem);

fprintf(fileptr,"[WSforOutlookMailItemSearching]-spMailItem::Success\r\n");
fflush(fileptr);

CComQIPtrOutlook::_Inspector spInspector;
spMailItem-get_GetInspector(&spInspector)
}

- Kiran. S



  #8  
Old September 11th 09, 02:35 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to get Selected Body message Text

There is no event for that in the Outlook object model.

You'd have to open the item so it was being handled by WordMail, get
Inspector.WordEditor as a Word.Document object, then get the Parent property
of that as Word.Application and use the
Word.Application.WindowSelectionChange() event.

If the text was selected in the reading pane I don't know of a way to get an
event for that at all.

--
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


"pasteface method crashing outlook"
oft.com wrote in message
...
can you tell me which event is needed to handle , when we select the text
in
outlook 2007.

-Kiran.S


 




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
Reply with custom form & selected data from message body GregoryL.[AITI] Outlook and VBA 3 May 28th 09 03:46 PM
Copying selected text from a message body CharlieH Outlook and VBA 4 December 2nd 08 03:16 PM
How Do I determing what text is currently selected in message body Don Outlook and VBA 4 August 23rd 07 02:38 PM
IMPORTANT Software-Development: How to identify the body/sender/recipient when the selected message is changed Kevin Stumpf Outlook Express 1 June 20th 06 11:46 AM
Can't see message body until Reply or Fwd is selected Jen Outlook - General Queries 0 March 16th 06 02:31 PM


All times are GMT +1. The time now is 02:52 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.