Copying Emails using drag and drop

Status
Not open for further replies.

Laser

Member
Outlook version
Email Account
POP3
After extensive searching and googling, I have to conclude that I cannot find an answer to my query. So I turn to the experts in the hope they have an answer.

I have a local POP account within Outlook 2003 and an IMAP account. I often move mail within the local account and would like it to be reflected within the IMAP account. For example: if I drag an email from my inbox on the local account (POP) to a completed folder also within the local account, I would like the completed folders' added email to be copied to a subfolder within the IMAP account. Even better would be if Outlook detects when an email has been removed from the local folder and also updates the IMAP account.

Simply put, I would like folders in the local account when updated to be synchronised with the same folders in the IMAP account. I have experimented with using the itemadd property and have cobbled together the following which triggers when ever and email is added to a local folder but that is as far as I have got so far.

Private WithEvents Items As Outlook.Items
Private WithEvents Items1 As Outlook.Items
Private WithEvents Items2 As Outlook.Items
Private WithEvents Items3 As Outlook.Items
Private WithEvents Items4 As Outlook.Items
Private WithEvents Items5 As Outlook.Items
Private Sub Application_Startup()
Dim olApp As Outlook.Application
Set olApp = Outlook.Application
Set Items = GetNS(olApp).GetDefaultFolder(olFolderInbox).Items
Set Items1 = GetNS(olApp).GetDefaultFolder(olFolderInbox).Folders("Laser").Items
Set Items2 = GetNS(olApp).GetDefaultFolder(olFolderInbox).Folders("Orders Received").Items
Set Items3 = GetNS(olApp).GetDefaultFolder(olFolderInbox).Folders("Personal").Items
Set Items4 = GetNS(olApp).GetDefaultFolder(olFolderInbox).Folders("TempStore").Items
End Sub
Function GetNS(ByRef app As Outlook.Application) As Outlook.NameSpace
Set GetNS = app.GetNamespace("MAPI")
End Function
Private Sub Items_ItemAdd(ByVal Item As Object)
On Error GoTo ErrorHandler
MsgBox "You moved an item into the Inbox folder."
ProgramExit:
Exit Sub
ErrorHandler:
MsgBox Err.Number & " - " & Err.Description
Resume ProgramExit
End Sub
Private Sub Items1_ItemAdd(ByVal Item As Object)
On Error GoTo ErrorHandler
MsgBox "You moved an item into the Laser folder."
ProgramExit:
Exit Sub
ErrorHandler:
MsgBox Err.Number & " - " & Err.Description
Resume ProgramExit
End Sub
Private Sub Items2_ItemAdd(ByVal Item As Object)
On Error GoTo ErrorHandler
MsgBox "You moved an item into the 'Orders Received Folder."
ProgramExit:
Exit Sub
ErrorHandler:
MsgBox Err.Number & " - " & Err.Description
Resume ProgramExit
End Sub
Private Sub Items3_ItemAdd(ByVal Item As Object)
On Error GoTo ErrorHandler
MsgBox "You moved an item into the Personal folder."
ProgramExit:
Exit Sub
ErrorHandler:
MsgBox Err.Number & " - " & Err.Description
Resume ProgramExit
End Sub
Private Sub Items4_ItemAdd(ByVal Item As Object)
On Error GoTo ErrorHandler
MsgBox "You moved an item into the 'TempStore' folder."
ProgramExit:
Exit Sub
ErrorHandler:
MsgBox Err.Number & " - " & Err.Description
Resume ProgramExit
End Sub

One other area that I am considering, but having a lot of difficulty in finding a great deal of information about, is the utilisation of flags or categories to mark emails placed in a local folder with a flag or category and then using a VBA routine to find all emails so marked and to copy them to the IMAP equivalent folder. I would be grateful if anyone can indicate if I am on the right track. Many thanks in anticipation.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Does the macro work? If not, comment out all of the error handlers so you can see where the problem is.

Triggering on a flag or category might be easier- the category name could identify the folder and you could use one macro with the folder set via a variable (the category).

if the macro doesn't work, make sure you click in the startup macro and click Run.
 

Laser

Member
Outlook version
Email Account
POP3
Hello Diane, Thank you for your response. The code posted works fine. Whenever an email is dropped or sent to a monitored folder the itemadd trigger works fine and the MsgBox fires with "You moved an item into the 'Named Folder' folder." The problem I have is how to copy the email that was added to the local Outlook folder and triggered by the itemadd property to the IMAP folder. Cannot work out the code required for this and cannot find sensible references or code elsewhere.
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
T Location and simple copying of emails and settings, OL 2010 and Win 7 64bit. Using Outlook 3
J Random copying of emails in inbox and calendar appointments deleted Using Outlook 1
R VBA for copying sent email to current folder under a shared mailbox Outlook VBA and Custom Forms 17
E Copying the whole e-mail body into excel Outlook VBA and Custom Forms 0
E Copying data from e-mail attachement to EXCEL file via macro Outlook VBA and Custom Forms 38
T Copying Outlook Account Setup For Desktop App Using Outlook 5
J Outlook - 2013 - Error msg when copying folders from Online Archives to another user's mailbox Using Outlook 0
Thiago Manzano Copying E-mails to a folder on HD Using Outlook 1
Diane Poremsky Mark Sent Items as Read After Copying with a Rule New Slipstick.com Articles 0
crazyboy Copying BCM database from backed up mounted image to new drive BCM (Business Contact Manager) 2
oliv- Prevent copying shared contacts Outlook VBA and Custom Forms 5
Paul Butticaz Copying Contacts from SharePoint List (connected to Outlook) to another Conacts folder Using Outlook 1
K Outlook 2010 Not responding after IMAP folder deletion or copying. Using Outlook 2
Mary B Outlook 2013: Rule for copying new email to folder & marking that copy as read Using Outlook 1
S Calendar items are not being uploaded to outlook.com after copying Using Outlook.com accounts in Outlook 1
P open reminders missing after copying outlook pst file Using Outlook 2
O New to Outlook 2013, dealing with copying vs. moving sent items Using Outlook 0
S Recover messages that disappeared when copying to folder Using Outlook 1
S Copying multiple messages to folders and keeping date/time detail Using Outlook 1
D Copying POP3 folders from Inbox to IMAP Inbox in Outlook 2003 Using Outlook 0
M Copying setups for mutiple users Using Outlook 2
A Copying additional contact fields when chosing "Contact from the same company" Using Outlook 5
A Copying cc email addresses to Excel - does not copy the <joe.bloggs@isp.com> Using Outlook 1
S Search Indexing (Copying Folders) Using Outlook 0
I copying messages from inbox to folder outside outlook Using Outlook 2
C Copying an email. Using Outlook 1
B Moving or copying a Hotmail Folder to an external Hard Disk?____ Using Outlook 2
F copying outlook Using Outlook 3
T Copying contacts Using Outlook 3
I Copying mailboxes from Exchange 2003 to Exchange 2010 Exchange Server Administration 3
1 Error message when copying contacts from one group to another Using Outlook 2
R copying or cutting an appointment to paste it to a different date Using Outlook 1
O Copying Outlook Categories to the attachment (MS word) body in bulk. Is this possible? Using Outlook 7
S How to retain "Date Sent" and "Date Received" data when copying email messages from Outlook to an Ex Using Outlook 2
A Copying Outlook to Windows 7 Using Outlook 1
A Copying Outlook t5o Windows 7 Using Outlook 1
J Outlook won't allow hyperlink in email to work, but copying & posting hyperlink in browser works OK. Using Outlook 1
S Copying suggested outlook names from Outlook 2003 to 2010. Using Outlook 1
T Adding or copying a duplicate contact does not get detected and stopped Using Outlook 1
P copying calendar from desktop computer for use on laptop computer Using Outlook 1
Q Copying Outlook 2003/XP contact list to Outlook 2007/Windows 7 Using Outlook 25
E Copying multiple folders to PST Outlook VBA and Custom Forms 2
B Copying data between atbs in a custom form Outlook VBA and Custom Forms 4
R copying a custom view from a public folder and distributing programatically Outlook VBA and Custom Forms 3
N error when copying outlook data "can not copy: the path too deep" Using Outlook 6
N Copying outlook macros between pcs Outlook VBA and Custom Forms 1
R Copying Data from Exchange to PST file Outlook VBA and Custom Forms 1
V Copying contents from one field to another field Outlook VBA and Custom Forms 6
A Run-time error '430' on certain emails when trying to set "Outlook.mailitem" as "ActiveExplorer.Selection.Item" Outlook VBA and Custom Forms 2
J Moved many emails to Outlook external folder, need to delete on Gmail server Using Outlook 13
Similar threads


















































Top