Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extracting Email Body from Outlook
#1
Hi All,

I've been trying to simply display the body email of an email message in a message box (code below), but consistently get a general run error and I don't know where i've been wrong.  I've even attempted to save the email but get them 'General Run Error'.  

Any help would be appreciated! Thanks!

Using UFT version 14.51 and Outlook 2016

Code:
Set OutlookApp = CreateObject("Outlook.Application") Set myNamespace = OutlookApp.GetNameSpace("MAPI") Set myFolder = myNamespace.GetDefaultFolder(6) myFolder.Display Set colItems = myFolder.Items Set colFilteredItems = colItems.Restrict("[SenderEmailAddress] = 'no-reply@verificationemail.com'") For each item in colFilteredItems If item.Unread  Then If InStr(item.Subject, "SKF Insight Rail") > 0 Then 'item.SaveAs "C:\Email Data\Text.txt", 0 myBody = item.body item.unread = false End If End If Next msgbox myBody
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Extracting Email Body from Outlook waseem.khan.91 0 1,609 03-01-2019, 02:51 PM
Last Post: waseem.khan.91
  Find the email using subject with the help of vb script Raheem Shaik 0 2,181 12-12-2018, 02:57 PM
Last Post: Raheem Shaik
  Query for configuration of Mail Body section through VB/QTP prasanna.rathinam 1 3,568 09-19-2013, 12:03 PM
Last Post: ssvali
  Cannot attach the text file to email arpan 2 3,998 07-19-2013, 12:13 AM
Last Post: arpan
  Unable to send an email from Outlook which is already opened as draft attiliv 0 2,567 03-24-2013, 11:14 AM
Last Post: attiliv

Forum Jump:


Users browsing this thread: 1 Guest(s)