Move an email from outlook to a local folder

I am trying to move an email from an outlook folder to a local folder on my C drive, but i suspect that i am doing it wrong.

Dim ol As New Outlook.Application
Dim olns As Outlook.NameSpace
Dim mf As Outlook.MAPIFolder
Dim m As Outlook.MailItem
Dim destfolder As String

Set m = mf.Items.Item(i)
destfolder = "c:\test"

m.Move destfolder

What am I doing wrong?
Who is Participating?
Hi mjelec

The Move method is for moving an Outlook item to a different *Outlook* folder.

You need to use the SaveAs method:

m.SaveAs <filepath>, <type>

<filepath> should be the full path to the output file (folder and filename)
<type> is the format of the output file - it could be one of olHTML, olMSG, olRTF, olDoc, olTXT

More info here:

-- Graham
mjelecAuthor Commented:
Alright that seemed to work but now I get a runtime error:

"Cannot write to file: C:\test.  Right-click the folder that contains the file you want to, and then click the properties on the shortcut menu to check your permissions for the folder."

I cant seem to find any properties, this is just a folder on my c: drive.  I am using the code:

destfolder = "c:\test"
m.SaveAs destfolder, olMSG
mjelecAuthor Commented:
Wait I missed the File name part, it works.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.