Free Microsoft Outlook Resources & Whitepapers

VBA to assign category on calendar item does not work ?? why ??

Below i wrote code to assign a categorie to a calendar item based on the word "vrij" in the subject.
I got to automate a lot of words for a lot of people so this just the first keyword.
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

Sub AddCat(itm, catName)
arr = Split(itm.Categories, ",")
If UBound(arr) >= 0 Then
' item has categories
For I = 0 To UBound(arr)
If Trim(arr(I)) = catName Then
' category already exists on item
' no need to add it
Exit Sub
End If
Next
itm.Categories = itm.Categories & "," & catName
Else
' item has no categories
itm.Categories = catName
End If
End Sub


Post your answer or comment

comments powered by Disqus
Greetings!

Within an email, if I choose insert | item, and then find an item in a
public folder, choosing "Shortcut", the item appears as a shortcut, but
after I send the email, the shortcut does not work, even if I try to open
it.

- Double Clicking the item does nothing.
- On the Right click menu, "Open Message Object" is not available.

I know that I can use the Hyperlink method described at Slipstick:
http://www.slipstick.com/outlook/links.htm

What I want to do, strangely enough, is use the method that would appear to
be built into the product.

Any help is appreciated.
- Mike Scott
http://msthenetworker.blogspot.com/

Hi Ken...

It asking me what pst program I want to scan and having a hard time finding
it. You said: the next steps
usually are to run Scanpst.exe (Inbox repair tool) and if that doesn't help
then to create a new profile.

"Ken Slovak - [MVP - Outlook]" wrote:

Creating a new profile is a fix for many things, not just this. If
/cleanreminders doesn't work and /resetfolders doesn't work the next steps
usually are to run Scanpst.exe (Inbox repair tool) and if that doesn't help
then to create a new profile.

If I was using any badly written software that corrupted things regularly
I'd uninstall it and use something else.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

"BarleySystems" wrote in message
...
Based on your response below I am assuming that the only solution, when
PDA
software corrupts your reminders folder and /cleanreminders does not work,
is
to create a new profile? I did that and it worked. Thanks It is a shame
that my PDA has caused me to have to create a new profile and import all
of
my PST files, but at least now it works. Thanks again

Hi, I'd like to set up our (enterprise) Outlook 2003 to notify only for
calendar items, and not mail items. Is this possible? If not, is it
possible to set this up on individual mailboxes? This will keep the
notifications at a minimum - not appearing for email, only appearing for
appointments and meetings.
Thanks

The "send/receive" button on the toolbar does not work and also
"send/receive" does not work in the Tools drop-down menu. It says "Operation
Failed". I still can send and receive email because Outlook is set up to
send email immediately from Outbox and it checks for new mail every 5
minutes.

However, the buttons don't work. I sucessfully repaired Outlook but they
still do not work.

I have set the "open previous item" feature in Outlook 2007, but when I
delete an email I go back to the inbox -- the previous item does not
automatically open?!

I have two separate NTL accounts. For one of them, when selecting this
option in OE6, it works but for the other it does not and I have no idea why
not. In addition I observed that if I send a message ( from my Hotmail
address) to the address from the account where the selection does not work
the message is downloaded to OE Inbox twice! Could anyone please shed some
light on this for me?
Thanks
divoch

I just joined a windows 2000 machine to a domain, however, now when I try to
log in, ctrl-alt-del does not work, so I cant even get onto the machine

These keyboards work fine on other machines, and enter,f1, etc... work on
this machine.

Any suggestions?

Thanks

Help Please!

I am migrating (trying to) SBS 2003 from an old server to a new one. I have
used the Swing migration to get AD etc. from the old to the new server and
that works fine.

My issue is I cannot get the Exchange stores to mount. I have tried shutting
down the old Exchange and copying the contents of MDBDATA to the new server
but that does not work.

I have used the backup with SBS 2003 and backed up the old Exchange store
and tried to restore the .bkf file on the new server. When I try I get "The
backup file contains unrecognized data and cannot be used." error message.

As all users are using cache mode with Outlook 2003 I thought I could just
remove the contents of the MDBDATA folder (and Exchange will create empty
stores) and just recreate their mail boxes (their AD accounts are on the new
server). Is there a way that I can have Exchange use the user accounts (from
AD) to create empty mailboxes (thus create the private and public stores
(both empty))? If this is possible could the users (as they are using cache
mode) not 'repopulate' their own mailboxes on the new server?

Thanks

Kevin

Help Please!

(have also posted this in microsoft.public.exchange.misc)

I am migrating (trying to) SBS 2003 from an old server to a new one. I have
used the Swing migration to get AD etc. from the old to the new server and
that works fine.

My issue is I cannot get the Exchange stores to mount. I have tried shutting
down the old Exchange and copying the contents of MDBDATA to the new server
but that does not work.

I have used the backup with SBS 2003 and backed up the old Exchange store
and tried to restore the .bkf file on the new server. When I try I get "The
backup file contains unrecognized data and cannot be used." error message.

As all users are using cache mode with Outlook 2003 I thought I could just
remove the contents of the MDBDATA folder (and Exchange will create empty
stores) and just recreate their mail boxes (their AD accounts are on the new
server). Is there a way that I can have Exchange use the user accounts (from
AD) to create empty mailboxes (thus create the private and public stores
(both empty))? If this is possible could the users (as they are using cache
mode) not 'repopulate' their own mailboxes on the new server?

Thanks

Kevin

hello

i move .PST file from one account to another on one host and after starting
outlook with moved .pst file all spam go to inbox folder - anti-spam module
does not work. how to reset this module, how to fix it and force it to start
working. i had to download spamfighter to fight with spam but it is 30-day
demo software.

thanks for any help.
--
-----------------------------
Voytas

Hi,

I have used "Mark my comments" for years in Outlook and it works well. I
cannot get it to work in Outlook 2007. The change collor on reply also does
not work.

I have checked the box in Tools | Options | Email Options but it does not
work. Any help will be appreciated.
--
Thanks

When I receive e-mail in Microsoft Outlook which has a hyperlink to another
location, such as an e-mail from Williams-Sonoma with a hyerlink to its
Winter Specials, the hyperlink does not work. This happens not only with
Williams-Sonoma but with other e-mails.

How can I fixl this?

I am trying to handle some of the spam I get by using Outlook (2003)
Rules. I have created a rule where if the body of the message contains
the word 'hoodia' to delete the message. It simply does not work. I
can see the word, and it is not obfuscated using any HTML tricks, but
when I run the rule, the message is not deleted.

Any ideas?

I have several macros setup to move emails from my inbox to a specified
folder. I would like to know how to move calendar items such as meeting
requests, replies from people when they accept or decline a meeting invite,
etc. to a folder using a macro as well. Below is the macro I use to move
email items to a folder called "California", a sub-folder of my Inbox. I
want to know if I can modify this macro to also include moving calendar
items. if not, I would like to know what I need to do to move calendar items.

Sub MoveToCalifornia()
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("California") '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.Categories = "Personal"
objItem.Move objFolder
End If
End If
Next

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

I'm working on this tool that among other things creates an item on the users
outlook calendar. I would like to prevent creating duplicate items, that is
the tool should check to see if the calendar item exists before creating it.
Anyone have any thoughts on what the most effective way to do that is?
BTW I would consider the item duplicate if the subject and start time are
the same.


This worked, which was great, but does anyone know why this happens?

"Ken Slovak - [MVP - Outlook]" wrote:

Try starting Outlook with the /resetfolders and /cleanreminders switches. In
the Start, Run dialog:

outlook.exe /resetfolders /cleanreminders

Then press Enter. See if that helps.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

"Bob" wrote in message
news

Based on Sue Mosher's code at
http://www.outlookcode.com/codedetail.aspx?id=1333, the following code,
which is located inside a With ActiveDocument - End With construction, works
fine in Word 2007:

Set objDoc = .MailEnvelope.Item
With objDoc
.To = strEmail
.Subject = strSubject
.Save
strID = .EntryID
End With
Set objDoc = Nothing
Set objDoc =
oOutlookApp.Session.GetItemFromID(strID)
With objDoc
.Send
End With
Set objDoc = Nothing

ObjDoc is declared as an Object and strID as a String and earlier in the
code there is the following:

On Error Resume Next
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If

In Word 2003 however, it does not work and testing for strID using MsgBox
strID after it is set to .EntryID, I just get an empty message box so that
it appears that .EntryID is not being assigned.

Any clues on how to overcome this?

--
Regards,

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

I am using MS Outlook 2003.
At calendar task bar (sub-task bar at calendar), I have changed the
font of column and row from default one to Gulim(This is a Korean font)
at font size 8.
After that, I tried to change it back to default one but it does not
work.
When I changed setting to default, it seemed to be changed currectly,
but after I move to other category(Mail, Task, Notes) and come back to
it, the font and font size are changed to the font setting that I
previously changed one (Gulim, 8).

Any comments?

Thanks

Jawon Park

I am stumped - i just got a new T43 (internal corporate build) and after I
resume from a standby or a hibernate state, double clicking on calendar items
fails to open them. I cannot do a right mouse click/Open on the calendar
items either.

When this occurs, the calendar itself appears to be "disassociated" as I
cannot normally respond to meeting requests either.

I have tried outlook.exe /reset folders
I have re-installed Outlook and the same problem reappears.

The problem goes away after a restart or shutdown/restart but reoccurs
following the standby, hibernate events.

PLEASE HELP!!!!

Based on Sue Mosher's code at
http://www.outlookcode.com/codedetail.aspx?id=1333, the following code,
which is located inside a With ActiveDocument - End With construction, works
fine in Word 2007:

Set objDoc = .MailEnvelope.Item
With objDoc
.To = strEmail
.Subject = strSubject
.Save
strID = .EntryID
End With
Set objDoc = Nothing
Set objDoc =
oOutlookApp.Session.GetItemFromID(strID)
With objDoc
.Send
End With
Set objDoc = Nothing

ObjDoc is declared as an Object and strID as a String and earlier in the
code there is the following:

On Error Resume Next
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStarted = True
End If

In Word 2003 however, it does not work and testing for strID using MsgBox
strID after it is set to .EntryID, I just get an empty message box so that
it appears that .EntryID is not being assigned.

Any clues on how to overcome this?

--
Regards,

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

I would like to always automatically bcc a gmail address on an outlook
calendar appointments when setting the appointment. This is not the default
outlook calendar so the calendar sync does not work well, but an invite does.
Any ideas?

Our admin office tracks multiple calendars from multiple mailboxes, and has
been doing this without incident with Outlook 2003. Since the change to
2007, however, appointments that span multiple days do not wrap around when
printing or print previewing. This occurs on multiple workstations, not just
one. I've read many other posts around the web, but I cannot discern if they
are for text-wrapping for daily appointments, or the same issue I'm trying to
describe.

Using the Calendar Assistant is not a solution because it is not properly
handling multiple calendars, nor does it show different colored appointments.
Please advise if there is a workaround, or if this is a known issue, and how
soon a fix will be available. From what I've gathered, it's likely this is a
known issue, and has been for the better part of a year.

--
Bill Estep
Honolulu, HI

When I want to update or add an email address from an email sent to me, I am
suppose to be able to right click on the address in the From and get an
option to add to my contact list. This option does not show up for me! Any
help on this one?

When I try and print my calendar the time that my appointment ends does not
print. It only prints the start time. How do I fix this ?


Not finding an answer? Try a Google search.