A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Assigning Categories to Emails



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old February 15th 06, 01:52 PM posted to microsoft.public.outlook.program_vba
Keith Brown
external usenet poster
 
Posts: 1
Default Assigning Categories to Emails

I am using a bunch of macros that someone programmed for me to move emails
from the Inbox to specific folders. Now I want to "expand" what the macro
and the person who did the programming no longer works for us.

The basic macro is as follows, and I don't know what to add to the macro to
assign specific categories to the email. I know I will probably have to
duplicate the macro several times for each of the different categories I
might assign to it, but I am lost.


Sub MoveToFolderA()
On Error Resume Next

Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem

Set objNS = Application.GetNamespace("MAPI")
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Set objFolder = objInbox.Folders("FolderA") 'Assume this is a mail
folder

If objFolder Is Nothing Then
MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
"INVALID FOLDER"
End If

If Application.ActiveExplorer.Selection.Count = 0 Then
'Require that this procedure be called only when a message is
selected
Exit Sub
End If

For Each objItem In Application.ActiveExplorer.Selection
If objFolder.DefaultItemType = olMailItem Then
If objItem.Class = olMail Then
objItem.Move objFolder
End If
End If
Next

Set objItem = Nothing
Set objFolder = Nothing
Set objInbox = Nothing
Set objNS = Nothing
End Sub

Thanks,
Keith


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook Categories [email protected] Outlook - General Queries 2 February 27th 06 11:11 PM
Assigning a new organizer to a meeting. ejptccs123 Outlook - Calandaring 0 January 30th 06 05:00 PM
Tasks / assigning them... Ivan T. Williams Outlook - General Queries 0 January 25th 06 02:13 PM
Outlook Categories Outlook categories Outlook - Using Contacts 1 January 16th 06 02:48 PM


All times are GMT +1. The time now is 05:20 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.