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

Save .msg attachment as .rtf



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 18th 09, 05:31 PM posted to microsoft.public.outlook.program_vba
hlock
external usenet poster
 
Posts: 23
Default Save .msg attachment as .rtf

If an email has a .msg attachment, I need to save it off as an .rtf
attachment. Is there a way to do this?

If lngCount 0 Then
' We need to use a count down loop for
' removing items from a collection. Otherwise,
' the loop counter gets confused and only every
' other item is removed.
For i = lngCount To 1 Step -1
Dim path As String
' Get the file name.
strfile = objAttachments.Item(i).FileName
'Check filename of attachment to see if .msg
If Right(strfile, 3) = "msg" Then
strfile = Replace(strfile, " ", "_")
strfile = strfile & ".rtf"
path = fso.BuildPath(tempdir, strfile)
objAttachments.Item.SaveAsFile path, olRTF
ExecCmd "ttimport.exe " & app & " " & strfile
Else
strfile = Replace(strfile, " ", "_")
'Combine with the path to the Temp folder.
strfile = tempdir & strfile
' Save the attachment as a file.
objAttachments.Item(i).SaveAsFile strfile
ExecCmd "ttimport.exe " & app & " " & strfile
End If
Next i
End If
Thanks!!
Ads
  #2  
Old November 18th 09, 06:04 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Save .msg attachment as .rtf



As far as I know Outlook can save only rtf formatted messages as rtf files.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Wed, 18 Nov 2009 09:31:03 -0800 schrieb hlock:

If an email has a .msg attachment, I need to save it off as an .rtf
attachment. Is there a way to do this?

If lngCount 0 Then
' We need to use a count down loop for
' removing items from a collection. Otherwise,
' the loop counter gets confused and only every
' other item is removed.
For i = lngCount To 1 Step -1
Dim path As String
' Get the file name.
strfile = objAttachments.Item(i).FileName
'Check filename of attachment to see if .msg
If Right(strfile, 3) = "msg" Then
strfile = Replace(strfile, " ", "_")
strfile = strfile & ".rtf"
path = fso.BuildPath(tempdir, strfile)
objAttachments.Item.SaveAsFile path, olRTF
ExecCmd "ttimport.exe " & app & " " & strfile
Else
strfile = Replace(strfile, " ", "_")
'Combine with the path to the Temp folder.
strfile = tempdir & strfile
' Save the attachment as a file.
objAttachments.Item(i).SaveAsFile strfile
ExecCmd "ttimport.exe " & app & " " & strfile
End If
Next i
End If
Thanks!!

  #3  
Old November 18th 09, 07:06 PM posted to microsoft.public.outlook.program_vba
hlock
external usenet poster
 
Posts: 23
Default Save .msg attachment as .rtf

What about fooling it? Can we copy all of the aspects of the .msg (To, From,
CC, Subject, Body, etc) and create and .rtf. We are trying to avoid
importing .msg files into our document respository system since who knows
what email system we may be on later down the road. Any thoughts... If this
might work, how would I go about doing this?

"Michael Bauer [MVP - Outlook]" wrote:



As far as I know Outlook can save only rtf formatted messages as rtf files.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Wed, 18 Nov 2009 09:31:03 -0800 schrieb hlock:

If an email has a .msg attachment, I need to save it off as an .rtf
attachment. Is there a way to do this?

If lngCount 0 Then
' We need to use a count down loop for
' removing items from a collection. Otherwise,
' the loop counter gets confused and only every
' other item is removed.
For i = lngCount To 1 Step -1
Dim path As String
' Get the file name.
strfile = objAttachments.Item(i).FileName
'Check filename of attachment to see if .msg
If Right(strfile, 3) = "msg" Then
strfile = Replace(strfile, " ", "_")
strfile = strfile & ".rtf"
path = fso.BuildPath(tempdir, strfile)
objAttachments.Item.SaveAsFile path, olRTF
ExecCmd "ttimport.exe " & app & " " & strfile
Else
strfile = Replace(strfile, " ", "_")
'Combine with the path to the Temp folder.
strfile = tempdir & strfile
' Save the attachment as a file.
objAttachments.Item(i).SaveAsFile strfile
ExecCmd "ttimport.exe " & app & " " & strfile
End If
Next i
End If
Thanks!!

.

  #4  
Old November 18th 09, 07:57 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Save .msg attachment as .rtf

Do you really mean embedded message attachments or regular attachments with
an .MSG extension?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"hlock" wrote in message
...
If an email has a .msg attachment, I need to save it off as an .rtf
attachment. Is there a way to do this?

If lngCount 0 Then
' We need to use a count down loop for
' removing items from a collection. Otherwise,
' the loop counter gets confused and only every
' other item is removed.
For i = lngCount To 1 Step -1
Dim path As String
' Get the file name.
strfile = objAttachments.Item(i).FileName
'Check filename of attachment to see if .msg
If Right(strfile, 3) = "msg" Then
strfile = Replace(strfile, " ", "_")
strfile = strfile & ".rtf"
path = fso.BuildPath(tempdir, strfile)
objAttachments.Item.SaveAsFile path, olRTF
ExecCmd "ttimport.exe " & app & " " & strfile
Else
strfile = Replace(strfile, " ", "_")
'Combine with the path to the Temp folder.
strfile = tempdir & strfile
' Save the attachment as a file.
objAttachments.Item(i).SaveAsFile strfile
ExecCmd "ttimport.exe " & app & " " & strfile
End If
Next i
End If
Thanks!!



  #5  
Old November 18th 09, 10:11 PM posted to microsoft.public.outlook.program_vba
hlock
external usenet poster
 
Posts: 23
Default Save .msg attachment as .rtf

It's a regular attachment.

"Dmitry Streblechenko" wrote:

Do you really mean embedded message attachments or regular attachments with
an .MSG extension?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"hlock" wrote in message
...
If an email has a .msg attachment, I need to save it off as an .rtf
attachment. Is there a way to do this?

If lngCount 0 Then
' We need to use a count down loop for
' removing items from a collection. Otherwise,
' the loop counter gets confused and only every
' other item is removed.
For i = lngCount To 1 Step -1
Dim path As String
' Get the file name.
strfile = objAttachments.Item(i).FileName
'Check filename of attachment to see if .msg
If Right(strfile, 3) = "msg" Then
strfile = Replace(strfile, " ", "_")
strfile = strfile & ".rtf"
path = fso.BuildPath(tempdir, strfile)
objAttachments.Item.SaveAsFile path, olRTF
ExecCmd "ttimport.exe " & app & " " & strfile
Else
strfile = Replace(strfile, " ", "_")
'Combine with the path to the Temp folder.
strfile = tempdir & strfile
' Save the attachment as a file.
objAttachments.Item(i).SaveAsFile strfile
ExecCmd "ttimport.exe " & app & " " & strfile
End If
Next i
End If
Thanks!!



.

  #6  
Old November 18th 09, 11:32 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Save .msg attachment as .rtf

You can try to save the attachment as an MSG file and then import it back
using Application.CreateItemFromTemplate, butt that will wipe out teh sender
and recipeint related properties.
plug
You can use Redemption to open the MSG file directly using
RDOSession.GetMessageFromMsgFile, and then call RDOMail.SaveAs ..., olRtf
/plug

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"hlock" wrote in message
...
It's a regular attachment.

"Dmitry Streblechenko" wrote:

Do you really mean embedded message attachments or regular attachments
with
an .MSG extension?

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"hlock" wrote in message
...
If an email has a .msg attachment, I need to save it off as an .rtf
attachment. Is there a way to do this?

If lngCount 0 Then
' We need to use a count down loop for
' removing items from a collection. Otherwise,
' the loop counter gets confused and only every
' other item is removed.
For i = lngCount To 1 Step -1
Dim path As String
' Get the file name.
strfile = objAttachments.Item(i).FileName
'Check filename of attachment to see if .msg
If Right(strfile, 3) = "msg" Then
strfile = Replace(strfile, " ", "_")
strfile = strfile & ".rtf"
path = fso.BuildPath(tempdir, strfile)
objAttachments.Item.SaveAsFile path, olRTF
ExecCmd "ttimport.exe " & app & " " & strfile
Else
strfile = Replace(strfile, " ", "_")
'Combine with the path to the Temp folder.
strfile = tempdir & strfile
' Save the attachment as a file.
objAttachments.Item(i).SaveAsFile strfile
ExecCmd "ttimport.exe " & app & " " & strfile
End If
Next i
End If
Thanks!!



.



  #7  
Old November 19th 09, 06:47 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Save .msg attachment as .rtf



RDOSession.GetMessageFromMsgFile, and then call RDOMail.SaveAs ..., olRtf


Would that preserve formattings of an html message?

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Wed, 18 Nov 2009 16:32:19 -0700 schrieb Dmitry Streblechenko:

You can try to save the attachment as an MSG file and then import it back
using Application.CreateItemFromTemplate, butt that will wipe out teh

sender
and recipeint related properties.
plug
You can use Redemption to open the MSG file directly using
RDOSession.GetMessageFromMsgFile, and then call RDOMail.SaveAs ..., olRtf
/plug

  #8  
Old November 19th 09, 04:48 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Save .msg attachment as .rtf

That depends on whether the HTML is stored as RTF wrapped HTML in
PR_RTF_COMPRESSED.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Michael Bauer [MVP - Outlook]" wrote in message
. ..


RDOSession.GetMessageFromMsgFile, and then call RDOMail.SaveAs ..., olRtf


Would that preserve formattings of an html message?

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Wed, 18 Nov 2009 16:32:19 -0700 schrieb Dmitry Streblechenko:

You can try to save the attachment as an MSG file and then import it back
using Application.CreateItemFromTemplate, butt that will wipe out teh

sender
and recipeint related properties.
plug
You can use Redemption to open the MSG file directly using
RDOSession.GetMessageFromMsgFile, and then call RDOMail.SaveAs ..., olRtf
/plug



  #9  
Old November 19th 09, 05:46 PM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Save .msg attachment as .rtf



Is there any way a user can control that?

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Thu, 19 Nov 2009 09:48:09 -0700 schrieb Dmitry Streblechenko:

That depends on whether the HTML is stored as RTF wrapped HTML in
PR_RTF_COMPRESSED.

  #10  
Old November 19th 09, 06:31 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Save .msg attachment as .rtf

Nope. It is what the message stores.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Michael Bauer [MVP - Outlook]" wrote in message
...


Is there any way a user can control that?

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: http://www.vboffice.net/product.html?pub=6&lang=en


Am Thu, 19 Nov 2009 09:48:09 -0700 schrieb Dmitry Streblechenko:

That depends on whether the HTML is stored as RTF wrapped HTML in
PR_RTF_COMPRESSED.



 




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
How to save attachment? jayC[_2_] Outlook - General Queries 2 April 22nd 08 02:06 PM
attachment save godadj Outlook and VBA 0 February 11th 08 04:41 PM
Save Attachment via VBA Roger Converse Outlook and VBA 5 January 14th 08 05:16 PM
Can't Save Attachment Pavan Outlook - Using Forms 1 August 14th 07 02:36 PM
OE6 don't save modifcation on attachment Sorin TENE Outlook Express 7 April 6th 06 09:27 AM


All times are GMT +1. The time now is 03:36 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.