I try to assign category based on subject in appointment (code included)

Below i wrote code to assign a categorie to a calendar item based on the word "vrij" in the subject.
I think this code should work.. but somehow it doesnt
I use Outlook 2003 with macro security set to lowest level. The code is placed in  "this outlook session"
Any ideas why it doesnt work ??

====================================================

Dim WithEvents colRDVItems As Items
 
Private Sub Application_Startup()
Dim NS As Outlook.NameSpace
Set NS = Application.GetNamespace("MAPI")
Set colRDVItems = NS.GetDefaultFolder(olFolderCalendar).Items
Set NS = Nothing
End Sub

Private Sub colRDVItems_ItemAdd(ByVal Item As Object)

    If Item.Class = olAppointment Then
        If InStr(LCase(Item.Subject), "vrij") > 1 Then
            AddCat Item, "Holiday"
            Item.Save
        End If
    End If
End Sub
0
PGT (9)
12/22/2009 12:39:58 PM
outlook.general 7254 articles. 4 followers. Follow

3 Replies
1851 Views

Similar Articles

[PageSpeed] 15

The programming group is 'down the hall' at microsoft.public.program_vba.
http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.outlook.program_vba&lang=en&cr=US

Is there a reason you are using VBA instead of rules?

-- 
Diane Poremsky [MVP - Outlook]
Outlook Tips: http://www.outlook-tips.net/
Outlook & Exchange Solutions Center: http://www.slipstick.com/

Outlook Tips by email:
mailto:dailytips-subscribe-request@lists.outlooktips.net

EMO - a weekly newsletter about Outlook and Exchange:
mailto:EMO-NEWSLETTER-SUBSCRIBE-REQUEST@PEACH.EASE.LSOFT.COM

Poll: What version of Outlook do you use?
http://forums.slipstick.com/showthread.php?t=27072


"PGT" <user@msgroups.net/> wrote in message 
news:e2A9ePwgKHA.5528@TK2MSFTNGP05.phx.gbl...
> Below i wrote code to assign a categorie to a calendar item based on the 
> word "vrij" in the subject.
> I think this code should work.. but somehow it doesnt
> I use Outlook 2003 with macro security set to lowest level. The code is 
> placed in  "this outlook session"
> Any ideas why it doesnt work ??
>
> ====================================================
>
> Dim WithEvents colRDVItems As Items
>
> Private Sub Application_Startup()
> Dim NS As Outlook.NameSpace
> Set NS = Application.GetNamespace("MAPI")
> Set colRDVItems = NS.GetDefaultFolder(olFolderCalendar).Items
> Set NS = Nothing
> End Sub
>
> Private Sub colRDVItems_ItemAdd(ByVal Item As Object)
>
>    If Item.Class = olAppointment Then
>        If InStr(LCase(Item.Subject), "vrij") > 1 Then
>            AddCat Item, "Holiday"
>            Item.Save
>        End If
>    End If
> End Sub
>
> ---
> frmsrcurl: http://msgroups.net/microsoft.public.outlook.general/ 

0
Diane
12/22/2009 1:12:40 PM
yes i got to automate it with many keywords.
and it has to be done for a lot of people, keeping it in code should simply this.

so shown above "vrij" is just one keyword but, if this works then next i can add all other words and i can automate more, its part of something bigger.
0
PGT (9)
12/22/2009 1:18:00 PM
Ok. Then VBA makes sense. Try the programmer group - the VBA experts hang 
out there.

-- 
Diane Poremsky [MVP - Outlook]
Outlook Tips: http://www.outlook-tips.net/
Outlook & Exchange Solutions Center: http://www.slipstick.com/

Outlook Tips by email:
mailto:dailytips-subscribe-request@lists.outlooktips.net

EMO - a weekly newsletter about Outlook and Exchange:
mailto:EMO-NEWSLETTER-SUBSCRIBE-REQUEST@PEACH.EASE.LSOFT.COM

Poll: What version of Outlook do you use?
http://forums.slipstick.com/showthread.php?t=27072


"PGT" <user@msgroups.net/> wrote in message 
news:#3vyvkwgKHA.2104@TK2MSFTNGP05.phx.gbl...
> yes i got to automate it with many keywords.
> and it has to be done for a lot of people, keeping it in code should 
> simply this.
>
> so shown above "vrij" is just one keyword but, if this works then next i 
> can add all other words and i can automate more, its part of something 
> bigger.
>
> ---
> frmsrcurl: 
> http://msgroups.net/microsoft.public.outlook.general/I-try-to-assign-category-based-on-subject-in-appointment-code- 

0
Diane
12/22/2009 1:23:15 PM
Reply:

Similar Artilces:

return value based on combo box selection
I have a combo box (cmbShipDate) in a form that is based on a table with drop down values of ShipDate1, ShipDate2, ShipDate3, etc. I have created a text box and I want the correct ship date to be displayed based on the combo box selection. These ship dates are all stored in a table called tblOrder. I thought I could use the DLookUp fuction, but I'm not doing something correctly. Thanks I don't understand what you mean by "based on a table with drop down values". And when you say the "ship dates are all stored in ... tblOrder", do you mean tha...

can't re-call or re-schedule outlook meeting, appointment
Why can't I re-call appointment or meeting, I sent out? I can't even re-schedule it, reschedule button is greyed out. What settings I need to look at to enable re-schedule option, if not what is the purpose of reschedule button in Outlook 2003? MC ...

Cant re-assign a task to yourself once allocated to someone else
Hi, we use a job funnel to group all the upcoming tasks together, then someone allocates them out. But they cant allocate any tasks to themself. The "Owner" keeps changing back to the origional name the task was assigned to. Creating a new task and assigning it to yourself works fine. Re-assigning a task to anyone else also works fine. Is this a bug or a permission issue? Rohan - was a bug introduced in Rollup1 and has been fixed, apparently, in Rollup 3 which was released last week. if you look at the KB for Ru3: http://support.microsoft.com/kb/961768 you can search it for t...

Display/Hide a Form Control/Field Based On Another Field Value?
Hi all, I have to Combo boxes on a form. The first one I would always like users to see. The second, however, I would like hidden if the first box has certain values selected. So, if ComboBox1 has values of 1 or 2, I would like ComboBox2 to show as normal. If ComboBox1 has a value of 3, I would like ComboBox2 hidden. Is there a relatively simple way of doing this, if at all? Thanks for your help as always! --Eric You have to take care of 2 things: (1) When you move from record to record and the combo box contents changes (2) When the user changes the contents of the combo box For (1), inse...

Filter Datasheet based on Combo Box selection
I have a SubForm that displays in Datasheet view. I want to add a Combo Box just above the SubForm that the user can select the Pay_Period_Ending_Date, and once selected I would like the Datasheet to filter based on this date. Can someone please direct me as to how I can do this? -- Message posted via http://www.accessmonster.com Pasadena-D - You can put your combobox in the header section of the subform. Then based on the selection in the combobox, you can apply your filter like this (using your fieldnames and combobox name). If the user will click on an item, you can ...

Send Email With Cell Conent as Part of the Subject
Hyperlink is able to send email with cell content in the Subject line. My Case =HYPERLINK("mailto:Collections_Admin?subject=Overdue Balance " & "_"& 'Sheet1'!G15,"Email To Collection Agency") Sheet1G15 has the data I want to show in the subject line. Is it possible to do this with Macros? I am using Lotus Notes for email. Thanks Igbert For lotus code see Sending mail from Lotus Notes (XL-Dennis) http://www.excelkb.com/?cNode=1X5M7A -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "igbe...

Can I receive an audio reminder of an upcoming appointment?
We just converted from Lotus Notes to MS Outlook 2007. Can I receive an audio reminder of an upcoming appointment? Please cc your response to sotesr@nd.gov. TIA Yes. Click the little speaker icon to the right of the reminder period and browse to choose any .wav sound from those stored on your computer. -- Regards, Jack Sadie jaxalad-buying@yahooREMOVE.co.uk "ND Pard" <NDPard@discussions.microsoft.com> wrote in message news:C0871FCD-F0FA-46FC-9053-38AA08FDAE1C@microsoft.com... > We just converted from Lotus Notes to MS Outlook 2007. > > Can I receive an audio r...

inserting texts in cell based on conditions
Hi, I would very much appreciate if someone could help me solving a problem, illustrated by the following example: Column A B C 1 1 "LB" 2 1 "DK" 3 4 1 1 "LB/DK" If there's a 1 in column A, the corresponding cell in column C should get the text "LB" inserted into it. If there's a 1 in column C, the corresponding cell in column C should get the text "DK" inserted into it. If both column A and B have ones in them, the corresponding cell should get the...

Expense data base
does anyone have a database to track household expenses (utilities, insurance, etc.) http://office.microsoft.com/en-gb/templates/TC102068841033.aspx?CategoryID=CT101428511033&av=ZAC000 Or http://www.microsoft.com/money/default.mspx -- Kevin3NF SQL Server dude You want fries with that? http://kevin3nf.blogspot.com/ I only check the newsgroups during work hours, M-F. Hit my blog and the contact links if necessary...I may be available. "cg" <cg@discussions.microsoft.com> wrote in message news:A799A57F-0129-408E-80A8-346685F420F3@microsoft.com... > does anyone h...

I want to format a cell based on an adjacent cells value
I would like a cell automatically formatted in the same way a conditional format works - but the format to be based on the value of an adjacent cell. Any ideas as I cant work out how or if I can achieve this Cumbo, Use Conditional Formatting, but change cell valve is to formula is and use something like this, will change the cell if A1=25 =$A$1=25, so if you select B5 and put this in conditional formatting cell B5 will change when A1 = 25 -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on an...

Counting cells based on color
I am looking for a "counting" formula that will count cells in a rang based on their color, so that if I color a series of dates (to sho 'vacation) the number of cells (days) will be counted...to keep trac of vacation...thanks -- Message posted from http://www.ExcelForum.com There's no built-in functionality for that - it requires a UDF (user-defined function). You'll find several examples in the google archives: http://www.google.com/advanced_group_search? as_ugroup=*excel*&lr=&num=100&hl=en MVP Chip Pearson also has some code: http://www.cpearson.com...

shared email, can't privatize appointments
I have 2 secys who share an email address. THey eachmade an Outlook calendar for themselves on their own laptop. However they say they can't keep any appt "private" from the other person--that "private" doesn't work. Is this true, and is there a way around it? -- kamp "kamp" <kamp@discussions.microsoft.com> wrote in message news:D667C78F-D0FD-4E82-A4FF-2EA717E4B66E@microsoft.com... >I have 2 secys who share an email address. THey eachmade an Outlook calendar > for themselves on their own laptop. However they say they can't ...

Quick Question on Categories
An anally organized person just realized this question... ;-) Maybe someone can help me out with your solution to the problem? I'd think that going to /see/ movies is considered different from buying them on video. So, when I go see a movie, is it considered Movies & Video, or on Cultural Events? Seeing a movie is questionable as a cultural event... Thanks, Kenneth "Kenneth Pardue" <kennethNOSPAM@pardue.com> wrote in message news:vnprkfirgng4de@corp.supernews.com... > An anally organized person just realized this question... ;-) > > Maybe someone can he...

How to Block and reply to message with NO SUBJECT in OL2000?
Can someone provide me with the code to paste into ThisOutlookSession that will allow me to delete mail with No Subject in Outlook 2000 AND will automatically send a reply to the originator. I use rules to autoreply to FW:, etc with boiler plate e-mail, but the rules in Outlook 2000 don't apply to NO SUBJECT. I'm not a VBA programmer, but can do a jam-up job of cut and paste. Thanks, Jake "Jake" <jclngvl@hotmail.com> wrote in message news:879563d9.0411201624.716617cf@posting.google.com... > Can someone provide me with the code to paste into ThisOutlookSession &...

This code doesn't work, why?
Create a new MCF project (test_odbc). Using the wizard, add a class to conect to a database in SQL server (CMyDB). The code looks like this: void Ctest_odbcApp::fun1(CRecordset *pRS) { CString csValue; pRS.GetFieldValue(0,csValue); // <- Generates a CDBException. Why? } BOOL Ctest_odbcApp::InitInstance() { CMyDB cDB; CString csValue; try { cDB.Open(); cDB.MoveFirst(); cDB.GetFieldValue(0,csValue);// <- This works fine fun1(&cDB); cDB.Close(); } catch(CDBException *pDBE) { pDBE->ReportError()...

SumIf
Hi =SUMIF(A6:A2000,"(left(a6:a2000,4))=(left($K$14,4))",F6:F2000) I want to create a sub total of all values in column F, at certain subtotal cells in column F where the the first 4 (or other to be set)characters of a code in cells a6 to a2000 match the first 4 characters in cell$K$14 (or other cell to be set). The above doesn't seem to work, is it possible? am I missing something? Any help would be greatly appreciated. Ritchi Try this array* formula: =SUM(IF(LEFT(A$6:A$2000,4)=LEFT($K$14,4),F$6:F$2000,0)) * As this is an array formula, then once you have typed it in (or s...

Counting number of rows based on mutiple criteria
Does anyone know how to count the number of rows based on mutiple criteria on other columns? For example I want to count the number row that meet the criteria of "Yes" in Col 2 and "Yes" in Col 3. The result would be 2 in the example below. I tried different combinations of Vlookup, Countif and Sumif and could not come up with anything that worked. Col 1 Col2 Col3 A Yes No B Yes Yes C No No D No Yes E Yes Yes Your help is greatly appreciated! Hi, =SUMPRODUCT((B1:B10=&qu...

What is the max length of a single piece of code?
I am trying to make this rather long piece of code work, but when I paste it, the VBA window makes it Red 'error' Text. Is their a maxiumum length that VBA will allow? stAppName = "C:\Program Files\Internet Explorer\iexplore.exe http://maps.google.co.uk/maps?f=q&hl=en&q=" & "from: " & Me.RunWaypoint_1 + ", London" & (" to: " + Me.RunWaypoint_2 + ", London") & (" to: " + Me.RunWaypoint_3 + ", London") & (" to: " + Me.RunWaypoint_4 + ", London") & (" to: ...

Trying to understand CAsyncSocket
I want to create a TCP server using CAsyncSocket. This is my plan, please tell me if/where I am wrong. I will create a "Listener" class derived from CAsyncSocket. In my class I will call Listen. When my "listener" class's OnAccept function is called I will know that someone wants to connect to me. In the OnAccept function I will first dynamically allocate, using "new", a different "worker" class that I derived from CAsyncSocket. I pass a reference to this class as a parameter to the Accept function. At that point the "worker" class ...

Suspicions about the MFC42.DLL included with Windows Server 2003 SP1
Hello, I have some questions about some things I just discovered about the MFC42.DLL that ships with Windows Server 2003 SP1. It appears that the DLL was built with newer code than the latest VC++ 6 service pack. I work on an application that uses Visual C++ 6.0 with SP6. Users were reporting problems using Server 2003, so I had to find the problem. I narrowed the problem down to the fact that in the MFC42.DLL found on Server 2003, the CRecentFileList::Add() function can throw an exception while other versions of MFC42.DLL do not. When left unhandled, the user gets a message box stating &qu...

Is there a way to put html code in title attribute in xsl? thanks!
I need put some html code into title attribute of A tag, so that user could see html when they move mouse over the link, I think this isn't a standard use, but it does work. The problem is how can I prevent the xsl transfer the html when it does the transformation. I would like something like <A title="<b>test</b>"> but I end up with <A title="&lt;b&gt;test&lt;/b&gt;"> Any idea? Thanks! david wrote: > I need put some html code into title attribute of A tag, so that user could > see html when they move mouse over the lin...

Try this correction package
--cmmsnunwpw Content-Type: multipart/related; boundary="rewxxgfscrv"; type="multipart/alternative" --rewxxgfscrv Content-Type: multipart/alternative; boundary="potqqbkgxfmns" --potqqbkgxfmns Content-Type: text/plain Content-Transfer-Encoding: quoted-printable MS Customer this is the latest version of security update, the "September 2003, Cumulative Patch" update which fixes all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express as well as three newly discovered vulnerabilities. Install now to protect you...

Smart List Builder install documentation include on all workstati
In the documentation for Smart List Builder install it should include that it needs to be installed on all workstations that use the shared reports dictionary. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGro...

Help with counting based on two conditions
Using Excel 2000, I want to count how many customers are actively enrolled in a program at a given date. Column A contains the Customer Name Column B contains Program Start Date Column C contains Program End Date If I want to count how many people were on the program from April 1, 1999 to May 31, 2000 which would include those with a start date before April 1, 1999 but who do not have an end date. I tried Column D with my begin date criteria (August 1, 1996) Column E with my end date criteria (March 31, 2001) Column F to hold my counted start dates with the formula =COUNTIF(B11:B19, &quo...

Item Assign to a Site
Hi : I use to assign item to a site. But today while trying to assign any item to a site, it does not. I went through Cards>> Inventory >> Item >> Item Qty and Site go to button >> Selected the site >> Save. But fail. There is no link created between item and site. What could be the reason. I am using Great Plains 8 with service pack 3. I cannot apply service pack 4 because I don't have SQL2005 yet. Thanks Did it just fail silently, or did you receive an error message? -- dlothspe[MSFT]@online.microsoft.com This posting is provided "AS IS"...