Link to home
Start Free TrialLog in
Avatar of mjelec
mjelec

asked on

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?
ASKER CERTIFIED SOLUTION
Avatar of Graham Mandeno
Graham Mandeno
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mjelec
mjelec

ASKER

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
Avatar of mjelec

ASKER

Wait I missed the File name part, it works.