PDA

View Full Version : [SOLVED] Help getting body text from new message into a string



gibbo1715
12-06-2005, 03:44 AM
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

gibbo1715
12-06-2005, 04:22 AM
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