PDA

View Full Version : automatically save emails to hard drive



tuo.cheng
10-03-2013, 01:45 AM
I have code that can save emails to C:\users. However this macro can only be triggered by hitting a macro button. Is there anyway that I can trigger the macro automatically when I move an email to a special outlook folder?

tuo.cheng
10-03-2013, 09:06 AM
Could any expert help me pls? it is important to me. many thanks

Mark90
10-04-2013, 04:11 AM
Be careful about bumping your thread tuo. Might hurt your chances of it getting answered. Good luck!

tuo.cheng
10-04-2013, 04:53 AM
Sry I was a little desperate about getting answered...

Mark90
10-04-2013, 06:19 AM
Was just reading the FAQ's before I saw your post and wanted to give you a head's up. Us newbies and all that.

shaaneson
10-09-2013, 12:51 AM
Thank you vet much for your valuable contribution. keep sharing info. GOD bless you

skatonni
10-10-2013, 04:13 PM
I have code that can save emails to C:\users. However this macro can only be triggered by hitting a macro button. Is there anyway that I can trigger the macro automatically when I move an email to a special outlook folder?

See here http://msdn.microsoft.com/en-us/library/office/ff869609.aspx

The "special outlook folder" goes in Public Sub Initialize_handler() replacing the Contact folder.

Replace all the code in Private Sub myOlItems_ItemAdd(ByVal Item As Object) with your code.

Save it in the "ThisOutlookSession" module. Close Outlook and restart.

The event "Occurs when one or more items are added to the specified collection. This event does not run when a large number of items are added to the folder at once."


Public WithEvents myOlItems As Outlook.Items

Public Sub Initialize_handler()

Set myOlItems = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Folders("a special folder").Items

End Sub


Private Sub myOlItems_ItemAdd(ByVal Item As Object)

' Code to save emails

End Sub

tuo.cheng
10-11-2013, 06:17 AM
Dear skatonni

Thank you so much for your kind reply. Unfortunately, when I move an new mail to the Outlook folder, nothing happened.

Best

tuo.cheng
10-11-2013, 07:57 AM
Dear skatonni

I am sorry for the previous pose. Your code totally worked! Thank you so much!!!!!!