Categorize and move Outlook Email

Status
Not open for further replies.

acpete48317

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
I am new to programming in VBA and very new to Outlook VBA. I am trying to figure out how to apply an existing category in Outlook 2010 32 bit along with it's colored box as well as move that email to a folder in my Inbox. So far, I have the below code to move the currently selected email. Can anyone help with the category part of it? I am stumped.

Sub moveMail()
Dim objOutlook As Outlook.Application
Dim objNamespace As Outlook.NameSpace
Dim objSourceFolder As Outlook.MAPIFolder
Dim objDestFolder As Outlook.MAPIFolder
Dim objItem As Object

Set objOutlook = Application
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objSourceFolder = objNamespace.GetDefaultFolder(olFolderDrafts)
Set objItem = objOutlook.ActiveExplorer.Selection.Item(1)
Set objDestFolder = objNamespace.Folders("Adam.son@a.gov").Folders("CA")
'Change "CA" to the correct name in the outlook folder
'Change ""Adam.son@a.gov" and "CA" to refer to PST folder

objItem.Move objDestFolder

' Set all objects equal to Nothing to destroy them and
' release the memory and resources they take.

Set objDestFolder = Nothing
Set objOutlook = Nothing
Set objNamespace = Nothing
Set objSourceFolder = Nothing
Set objItem = Nothing
End Sub

Also, does anyone know of any background reading that would help with the theory of VBA?
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
The property name is Categories. When done with changing properties, you need to call Save eventually. Do so before moving the item.

The best souce for learning the object model ist the object browser. Press f2 to open it.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
P Categorize in Calendar not listed under tags in Office 365 (Office 2016) Using Outlook 5
P Automatically Categorize Meetings once they are accepted Outlook VBA and Custom Forms 5
K Maximum Categorize Shortcuts In Outlook 2010? Using Outlook 1
King Mustard Maximum Categorize shortcuts in Outlook 2010? Using Outlook 1
C Auto categorize duplicate subjects Outlook VBA and Custom Forms 11
A Categorize Outgoing Mail Outlook VBA and Custom Forms 3
R Categorize Button in Quick Access Toolbar Disappears on New Email Using Outlook 1
Diane Poremsky Categorize Messages using Contact Category New Slipstick.com Articles 0
J categorize problem outlook 2010 Using Outlook 3
L Categorize new email Using Outlook 1
D categorize tool disabled Using Outlook 7
C How can I customise the list of categories shown in the dropdown list when the [Categorize] button is pressed while adding a new Calendar appointment? Using Outlook 3
witzker Macro to move @domain.xx of a Spammail to Blacklist in Outlook 2019 Outlook VBA and Custom Forms 4
G Move tasks up/down todo list by VBA Outlook VBA and Custom Forms 1
S Macro to move “Re:” & “FWD:” email recieved the shared inbox to a subfolder in outlook Outlook VBA and Custom Forms 0
S Outlook Macro to move reply mail based on the key word in the subjectline Outlook VBA and Custom Forms 0
D Move Email with Attachment to Folder Outlook VBA and Custom Forms 3
Eike Move mails via macro triggered by the click of a button? Outlook VBA and Custom Forms 0
G Cannot Move Autocomplete File to New Computer Using Outlook 15
M Move to Folder Using Outlook 1
P Move emails between 2 mailboxes. Using Outlook 0
C Copy Move item won't work Outlook VBA and Custom Forms 2
N Macro to move all recipients to CC while replying Outlook VBA and Custom Forms 0
Commodore Move turns into "copy" Using Outlook 3
R List folders in a combo box + select folder + move emails from inbox to that folder + reply to that email Outlook VBA and Custom Forms 1
Jennifer Murphy Ctrl+Tab sometimes will not move through text a word at a time Using Outlook 1
V Outlook 2016 will not move emails in search results Using Outlook 4
M move to iCloud not working in outlook calendar Using Outlook 12
A Create date folder and move messages daily Outlook VBA and Custom Forms 1
Commodore Folders always closed in move/copy items dialog box Using Outlook 3
C Move Outlook 2007 to new PC with Outlook 365 Using Outlook 3
C Can't move folder, the folder is full Using Outlook 0
Nadine Rule to move attachments with specific name Outlook VBA and Custom Forms 1
A Move email items based on a list of email addresses Outlook VBA and Custom Forms 40
T Move calendar invites to new calendar Using Outlook 5
O Rule to move (specific) messages from Sent folder to Specific folder Using Outlook 1
I Automating message move between folders Outlook VBA and Custom Forms 0
K Outlook Rules: Move a Copy Using Outlook 4
K VBA BeforeItemMove event create rule to always move to its folder. Outlook VBA and Custom Forms 4
N Move emails of same conversation to same subfolder Using Outlook 6
P when i move inbox mails to another folder in outlook the mail disappears Using Outlook 1
Peter H Williams How to Move Mail item after processing Outlook VBA and Custom Forms 5
D Move Emails between Folders in Separate Mailbox Outlook VBA and Custom Forms 12
E Search for folder by key in subject then move new message to related folder Outlook VBA and Custom Forms 1
I Outlook 2013 Any way to move .OST file to new system? Using Outlook.com accounts in Outlook 5
O On click,I want to change subject line of selected mail and then reply to particular email and move Using Outlook 3
F "Move to" O365 feature to Outlook client via VBA Outlook VBA and Custom Forms 4
B Macro to manually move selected emails to network folder Outlook VBA and Custom Forms 1
L Making rule to move email to folder from one O365 domain Using Outlook 1
B Copy/Move Exchange inbox to Pop inbox Using Outlook 4

Similar threads

Top