Retrieving message body text of currently selected message 
Author Message
 Retrieving message body text of currently selected message

I am trying to retrieve the text from the currently selected message.  I
want
to assign this to a macro button on the tool bar (not automatically run with
application start).

I'm having a hard time getting the proper sequence of events to take place.
Any help would be much appreciated.

- Peter



Mon, 04 Nov 2002 03:00:00 GMT  
 Retrieving message body text of currently selected message
You need to use the ActiveExplorer.Selection object, something like this:

Sub DoSomethingWithText()
    Dim objItem as Object
    Set objItem = GetCurrentItem()
    If Not objItem Is Nothing Then
        MsgBox objItem.Body
    End If
    Set objItem = Nothing
End Sub

Function GetCurrentItem() As Object
    Dim objApp As Application
    Dim objSel As Selection

    Set objApp = CreateObject("Outlook.Application")
    Set objSel = objApp.ActiveExplorer.Selection
    If objSel.Count > 0 Then
         Set GetCurrentItem = objSel.Item(1)
    End If

    Set objSel = Nothing
    Set objApp = Nothing
End Function

--
Sue Mosher
Author of
  "Teach Yourself Microsoft Outlook 2000 Programming in 24 Hours"
  "Microsoft Outlook 2000 E-mail and Fax Guide"

Outlook and Exchange solutions at http://www.slipstick.com


Quote:
> I am trying to retrieve the text from the currently selected message.  I
> want
> to assign this to a macro button on the tool bar (not automatically run
with
> application start).

> I'm having a hard time getting the proper sequence of events to take
place.
> Any help would be much appreciated.

> - Peter



Tue, 05 Nov 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Retrieve currently selected text under VBE

2. Replacing message body text in Outlook 2000 7 XP

3. Put formatted (.rtf) text in message body from Access

4. extract message body to text file

5. extract message body to a text file

6. Text insertion into message body?

7. Setting BODY of message to text

8. Retrieving the text of a message box

9. to retrieve the currently selected item in a ListView control

10. Is there a way to determine the currently highlighted message in VBA

11. Send a hyperlink as part of the message body

12. eMail SQL results in message body

 

 
Powered by phpBB® Forum Software