Consulting

Results 1 to 2 of 2

Thread: Help getting body text from new message into a string

  1. #1
    VBAX Expert
    Joined
    Jan 2005
    Posts
    574
    Location

    Help getting body text from new message into a string

    Can anyone tell me how to get the body text of an email into a string

    Tried the code below but it gives an error

    Cheers
    Gibbo

    Dim myMailItem As MailItem
    Dim StrTest As String
    StrTest = myMailItem.Body
    MsgBox StrTest
    Sorry just spotted this


    Sub GetSelectedMailText() Dim myOlSel As Outlook.Selection Dim strText As String 'check there's something selected If Application.ActiveExplorer.Selection.Count = 1 Then Set myOlSel = Application.ActiveExplorer.Selection strText = myOlSel.Item(1).Body 'do something with the mail item body text MsgBox strText End If End Sub
    Consider this solved
    Last edited by Aussiebear; 04-13-2023 at 01:44 PM. Reason: Adjusted the code tags

  2. #2
    VBAX Expert
    Joined
    Jan 2005
    Posts
    574
    Location

    Help getting body text from new message into a string

    I am using the code below to get the text from a message in my inbox into a string

    Dim myOlSel As Outlook.Selection
        Dim strText As String
         'check there's something selected
        If Application.ActiveExplorer.Selection.Count = 1 Then
            Set myOlSel = Application.ActiveExplorer.Selection
            strText = myOlSel.Item(1).Body
    Is it possible to get the body text from a new message into a string before i send it?

    Cheers

    gibbo
    Last edited by Aussiebear; 04-13-2023 at 01:45 PM. Reason: Adjusted the code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •