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 Email in MSG format



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old June 8th 06, 10:08 PM posted to microsoft.public.outlook.program_vba
Geoff
external usenet poster
 
Posts: 21
Default Save Email in MSG format

I'm using Outlook 2002, but the following advice will probably work for
Outlook 2003. (You'll have to check.)

Have you tried the SaveAs method of the mail item object?
The SaveAs method takes the optional "Type" argument. You can specify the
type as "olMsg".

Here's an example.

Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objFLDR As Outlook.MAPIFolder
Dim objSUBFLDR As Outlook.MAPIFolder
Dim objMI As Outlook.MailItem

Set objOL = New Outlook.Application
Set objNS = objOL.GetNamespace("MAPI")
Set objFLDR = objNS.Folders("Personal Folders")
Set objSUBFLDR = objFLDR.Folders("Inbox")
If objSUBFLDR.Items.Count 0 Then
Set objMI = objSUBFLDR.Items(1)
objMI.SaveAs "C:\Temp.msg", olMSG
End If

Set objMI = Nothing
Set objSUBFLDR = Nothing
Set objFLDR = Nothing
Set objNS = Nothing
Set objOL = Nothing

The problem with the above code is that Outlook security will prompt you
when the macro runs, saying that a program is trying to access Outlook data.
You will have to respond manually saying Yes (that's OK) or No. If this
intervention by security is a problem for you, then you would need to write
code using the Redemption library (if that's still usable in Outlook 2003).

Geoff





"LDMueller" wrote in message
...
I have Outlook 2003. I want to be able to write a macro to do a File, Save
As, then save the email in Outlook Message Format (e.g. .MSG) to a
particular
location (e.g. W:\EMAIL\).

Can anyone help me?

Thanks!



 




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 import contacts in a .msg format? Blaine Outlook - Using Contacts 5 June 8th 06 01:02 AM
MSG File Format Bill R Outlook - General Queries 0 April 19th 06 05:34 PM
MSG file format Bill Reynen Outlook - General Queries 0 April 19th 06 05:13 PM
I need to save a contact in SMTP format not exchange format. JAX Outlook - Using Contacts 0 February 15th 06 02:51 PM
Correct .msg format amiga1200 Outlook and VBA 1 January 12th 06 04:07 PM


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