[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Move an email from outlook to a local folder

Posted on 2011-04-27
Medium Priority
Last Modified: 2012-05-11
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?
Question by:mjelec
  • 2
LVL 20

Accepted Solution

GrahamMandeno earned 2000 total points
ID: 35479593
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

Author Comment

ID: 35483059
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

Author Comment

ID: 35483079
Wait I missed the File name part, it works.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
There can be many situations demanding the conversion of Outlook OST files to PST format and as such, there is no shortage of automated tools to perform this conversion. However, what makes Stellar OST to PST converter stand above the rest? Let us e…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question