USING OUTLOOK MACROS TO MOVE EMAIL ITEMS TO ANOTHER OUTLOOK ACCOUNT

HI All,

 Can this do able? or is there any way to sync data between two accounts?

AS

March 4th, 2015 4:18am

Hi

As per the information and details provided by you, to move the email items to another Outlook account using Outlook Macros, please follow these steps: -

Step 1: - Create your target folders

To create folders, right click where you want to the folders to be created and select New Folder from the pop-up menu.

Step 2: - Create your Outlook Macros

In Outlook (2007), click on the Tools | Macro menu item and select Visual Basic Editor. Copy/Paste the following VB Macro into the script editor. Make sure to change the name of the folders to match your email setting.

'Outlook VB Macro to move selected mail item(s) to a target folder

Sub MoveToFiled()

On Error Resume Next

Dim ns As Outlook.NameSpace

Dim moveToFolder As Outlook.MAPIFolder

Dim objItem As Outlook.MailItem

Set ns = Application.GetNamespace("MAPI")

'Define path to the target folder

Set moveToFolder = ns.Folders("Mailbox - Jim Merrell").Folders("@Filed")

If Application.ActiveExplorer.Selection.Count = 0 Then

   MsgBox ("No item selected")

 Exit Sub

End If

If moveToFolder Is Nothing Then

   MsgBox "Target folder not found!", vbOKOnly + vbExclamation, "Move Macro Error"

End If

For Each objItem In Application.ActiveExplorer.Selection

   If moveToFolder.DefaultItemType = olMailItem Then

      If objItem.Class = olMail Then

         objItem.move moveToFolder

      End If

  End If

Next

Set objItem = Nothing

Set moveToFolder = Nothing

Set ns = Nothing

End Sub

Step 3: - Test Macros

To test the macros, click Run on the menu, the green play button or press F5 in the VB Editor window. If no errors are displayed, verify that the selected email(s) has moved to the desired target folder.

I hope this information will be helpful for you.

Thanks and regards

Shweta@G 

Free Windows Admin Tool Kit Click here and download it now
March 4th, 2015 6:45am

This is just to move between folders. not accounts
March 5th, 2015 1:09am

Hi,

In this forum we don't provide support about macros, if you need a macro method, I suggest you post the question in the Outlook for Developers forum:

https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=outlookdev

Besides a macro method, we can also use a rule to accomplish this request. I'll take Outlook 2013 for example:

Under HOME tab, click Rules button -> Manage Rules & Alerts -> Select the account you want the rule to apply to -> New Rule -> Apply rule on messages I receive -> Next -> Select the conditions you need, if you want this rule to apply to all incoming emails, don't select anything here -> Next -> Select "move a copy to the specified folder", click "specified" under "Step 2", select the folder of the account you want the emails moved to -> OK -> Next -> Make sure "Turn on this rule" -> Finish.

Please note this rule will only run when you check your emails in Outlook. If Outlook isn't running, this rule won't work for emails you check online or from another device.

I hope the information is helpful to you.

Regards,

Melon Chen

Forum Support

Free Windows Admin Tool Kit Click here and download it now
March 5th, 2015 7:40am

This is just to move between folders. not accounts

An account is comprised of a series of folders in a different data store so just a matter of picking the right store/folder for both source and destination.

That said, you may also want to clarify exactly what you mean when using the term "sync" which has a whole different meaning then simply "moving" items from one folder to another.

March 5th, 2015 6:50pm

Hi Karl,

  I have a Profile with two exchange accounts

 User1------Acct1- user1@acct1.com - Lot of sub folders

                  NewAcct- user1@newacct.com ---{ ...Need to copy all from Acct1 to this account)

As

               

Free Windows Admin Tool Kit Click here and download it now
March 5th, 2015 7:06pm

Hi Karl,

  I have a Profile with two exchange accounts

 User1------Acct1- user1@acct1.com - Lot of sub folders

                  NewAcct- user1@newacct.com ---{ ...Need to copy all from Acct1 to this account)

As

               

So is this a one-time activity or something you're going to do with these accounts on a regular basis. If it's only once, not sure why you would need macros of any kind and if it's on an on-going basis - seems like <Melon's> suggestion for creating a rule might be easier since you wouldn't want to<copy> items over again.

BTW - just to be clear - there is also a big difference in the meaning of the words <move> versus <copy> when talking about acting on items. <Move> will result in the items being deleted from the source after being copied and <copy> does just that - copy only.

However, as <Melon> said - if you do want/need to do the macro route, place to ask would be in the dev forum or perhaps even better in the Microsoft Office Programming forum which is more suited to macro based questions

http://answers.microsoft.com/en-us/office/forum/customize?sort=lastreplydate&dir=desc&tab=Threads&status=all&mod=&modAge=&advFil=&postedAfter=&postedBefore=&threadType=Questions&tm=1425601850307

March 5th, 2015 7:33pm

Hi,

Just checking in to see if the information was helpful. Please let us know if you would like further assistance.

Regards,

Melon Chen

Forum Support

Free Windows Admin Tool Kit Click here and download it now
March 8th, 2015 10:59pm

Hi,

I'm marking the reply as answer as there has been no update for a couple of days.

If you come back to find it doesn't work for you, please reply to us and unmark the answer.

Regards,

Melon Chen

Forum Support

March 11th, 2015 9:11pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics