We help IT Professionals succeed at work.

Move an email from outlook to a local folder

mjelec
mjelec asked
on
Medium Priority
890 Views
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?
Comment
Watch Question

Consultant
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

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

Author

Commented:
Wait I missed the File name part, it works.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.