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

Tags: , , ,

Adding Category to an Email programmatically





 
 
Thread Tools Display Modes
  #1  
Old January 17th 07, 02:02 AM posted to microsoft.public.outlook.program_vba
hepadmin
external usenet poster
 
Posts: 2
Default Adding Category to an Email programmatically

Hi,

just trying to create some code that responds to a Msgbox prompt when
the Outlook ItemSend event is fired.

My code is below and it all works fine except for the piece where I try
to assign a category to the email. If a user chooses Yes in the
msgbox, I want the email to be forwarded to the Records department(this
works) and for the email to be assigned a category of registered(this
doesn't).

Any help appreciated with this seemingly simple task.

Cheers,



Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
Boolean)

Dim str1 As String
Dim str2 As String
Dim myvar

str1 = "Would you like to register this email?"
str2 = "Records Management"

myvar = MsgBox(str1, vbYesNo, str2)

If myvar = 6 Then

Item.Categories = "Registered"
Item.Save

Set myRecip = ")
myRecip.Type = olBCC
Item.Recipients.ResolveAll

End If

End Sub

Ads
  #2  
Old January 17th 07, 02:31 AM posted to microsoft.public.outlook.program_vba
hepadmin
external usenet poster
 
Posts: 2
Default Adding Category to an Email programmatically

Sorry,

I need to correct the below. I need to be able to make the Categories
that are added in this process appear at the receiver's end. The below
code only affects the categories of the item on the local machine, ie.
in the Sent Items folder.

Any ideas?

Cheers,

hepadmin wrote:
Hi,

just trying to create some code that responds to a Msgbox prompt when
the Outlook ItemSend event is fired.

My code is below and it all works fine except for the piece where I try
to assign a category to the email. If a user chooses Yes in the
msgbox, I want the email to be forwarded to the Records department(this
works) and for the email to be assigned a category of registered(this
doesn't).

Any help appreciated with this seemingly simple task.

Cheers,



Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
Boolean)

Dim str1 As String
Dim str2 As String
Dim myvar

str1 = "Would you like to register this email?"
str2 = "Records Management"

myvar = MsgBox(str1, vbYesNo, str2)

If myvar = 6 Then

Item.Categories = "Registered"
Item.Save

Set myRecip = ")
myRecip.Type = olBCC
Item.Recipients.ResolveAll

End If

End Sub


  #3  
Old January 17th 07, 06:10 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,264
Default Adding Category to an Email programmatically


I think the receiver has a rule or somthing else running that deletes
categories of incoming messages.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)


Am 16 Jan 2007 17:31:02 -0800 schrieb hepadmin:

Sorry,

I need to correct the below. I need to be able to make the Categories
that are added in this process appear at the receiver's end. The below
code only affects the categories of the item on the local machine, ie.
in the Sent Items folder.

Any ideas?

Cheers,

hepadmin wrote:
Hi,

just trying to create some code that responds to a Msgbox prompt when
the Outlook ItemSend event is fired.

My code is below and it all works fine except for the piece where I try
to assign a category to the email. If a user chooses Yes in the
msgbox, I want the email to be forwarded to the Records department(this
works) and for the email to be assigned a category of registered(this
doesn't).

Any help appreciated with this seemingly simple task.

Cheers,



Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
Boolean)

Dim str1 As String
Dim str2 As String
Dim myvar

str1 = "Would you like to register this email?"
str2 = "Records Management"

myvar = MsgBox(str1, vbYesNo, str2)

If myvar = 6 Then

Item.Categories = "Registered"
Item.Save

Set myRecip = ")
myRecip.Type = olBCC
Item.Recipients.ResolveAll

End If

End Sub

 




Thread Tools
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
Problems while adding new Category in Outlook 2007 Ahmed Al-Lakani Add-ins for Outlook 1 September 10th 06 01:55 PM
Programmatically sending email from Access scariharry Outlook and VBA 0 July 5th 06 06:08 PM
How to programmatically save all email attachments in a folder Brian Beck Outlook and VBA 1 April 20th 06 03:47 PM
How to differ between received and sent email programmatically Darius Add-ins for Outlook 3 April 6th 06 09:06 PM
Adding information to columns in "Category" view emlawpro Outlook - Using Contacts 3 March 18th 06 03:12 AM


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2008 Outlook Banter, part of the NewsgroupBanter project.
The comments are property of their posters.
Loans - Secured Loans - MPAA - Free Ringtones - Mobile Phones