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 and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Body disappears in 2002 when creating an item from a saves msgattachment



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old October 30th 09, 11:09 AM posted to microsoft.public.outlook.program_vba
Peter Marchert[_2_]
external usenet poster
 
Posts: 12
Default Body disappears in 2002 when creating an item from a saves msgattachment

Hello,

I try to reference a message which is attached to an e-mail. I use the
following code to save the attachment first and then set a reference
to it:

Sub test()

Dim objReply As Outlook.MailItem
Dim objItem As Outlook.MailItem

Set objReply = Outlook.ActiveExplorer.Selection(1)

Call objReply.Attachments.Item(1).SaveAsFile("C:\test1. msg")
' open "C:\test1.msg" via windows explorer - body is ok

Set objItem = Outlook.CreateItemFromTemplate("C:\test1.msg")
Debug.Print objItem.Body ' - body is ok
Call objItem.SaveAs("C:\test2.msg", olMSG)
' open "C:\test2.msg" via windows explorer in 2002 - body is
blank
' open "C:\test2.msg" via windows explorer in 2003/2007 - body is
ok, but no PR_BODY property exists

Set objItem = Nothing
Set objReply = Nothing

End Sub

As you can see in the comments the body disappears when opening the
saved msg file in 2002.

If I use RDO the message is completely empty (e. g. subject):

Sub test2()

Dim objRDOMail As Object
Dim objRDOAtt As Object
Dim objRDOSession As Object

Set objRDOSession = CreateObject("Redemption.RDOSession")
objRDOSession.MAPIOBJECT = Outlook.Session.MAPIOBJECT

Set objReply = Outlook.ActiveExplorer.Selection(1)
Call objReply.Attachments.Item(1).SaveAsFile("C:\test1. msg")

Set objRDOMail = objRDOSession.CreateMessageFromMsgFile("C:
\test1.msg")
objRDOMail.SaveAs "C:\test2.msg"
' open "C:\test2.msg" via windows explorer in 2002 - message is
blank

End Sub

I want to ask if there is a workarround or a simplier way to get the
reference to an attached message.

Thanks
Peter
 




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
Message body (all my custom form labels/data) disappears when repl duugg Outlook - Using Forms 6 December 11th 08 01:49 PM
2002 HTML Signature Disappears KAquestions Outlook - General Queries 0 November 7th 08 10:11 AM
Which event is triggered when user saves email item? Kasper Add-ins for Outlook 4 September 22nd 06 02:26 PM
CALENDAR NO LONGER SAVES MY APPOINTMENTS "COULDNOT SAVE ITEM" BlueTdave Outlook - Calandaring 1 July 1st 06 06:07 AM
Pictures in mail item body Ivan Debono Outlook - General Queries 1 April 26th 06 10:52 PM


All times are GMT +1. The time now is 03:37 PM.


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.