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.
Similar threads
Thread starter Title Forum Replies Date
T Location and simple copying of emails and settings, OL 2010 and Win 7 64bit. Using Outlook 3
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 Using Outlook 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
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
richardwing Outlook 365 VBA to access "Other Actions" menu for incoming emails in outlook Outlook VBA and Custom Forms 0
U Outlook on the iPhone cannot approve filtered Emails Using Outlook 0
K Outlook 365 After migrating to Outlook 365, some contacts display in emails with prefixes Using Outlook 1
B Move emails from one account to another Outlook VBA and Custom Forms 2
D Unable to view older emails in desktop app Using Outlook 0
S Outlook 365 Help me create a Macro to make some received emails into tasks? Outlook VBA and Custom Forms 1
R Outlook 2021 Having problem setting up outlook 2021 with windows 11. I have 3 gmail accounts and I want the 3 gmail, emails to merge into the same outlook input. Using Outlook.com accounts in Outlook 0
S Outlook 2021 Can you make emails from 3 word domains "safe" by entering top 2 word domain into Safe List in Outlook? Using Outlook 1
J Outlook 365 Emails showing as links and text only Using Outlook 4
G Removing old emails when adding accounts Using Outlook 3
N VBA Macro To Save Emails Outlook VBA and Custom Forms 1
Horsepower Lost emails Using Outlook 4
P Emails assigned with a certain category (within a shared inbox) to be copied to a specific folder. Outlook VBA and Custom Forms 2
M Saving emails using Visual Basic - Selecting folder with msoFileDialogFolderPicker Outlook VBA and Custom Forms 6
L Emails being archived when I press the A key accidentally - how do I stop this? Using Outlook 0
N Save emails within a certain date range to network drive Outlook VBA and Custom Forms 0
M I cant send emails via Outlook in my W10 PC. Using Outlook 3
e_a_g_l_e_p_i Can emails from Gmail be deleted when they are downloaded to Outlook 2010 Using Outlook 1
D Wrong email address in Outlook 2003 "From" tab in new outgoing emails Using Outlook 4
witzker How to find all emails from and to a contact in OL 2019 Using Outlook 6

Similar threads

Top