Automatically Categorize Private Appointments

S

slapana

Is there a way to have Outlook 2007 automatically assign an appointment to a
category based on wether or not it's marked private? I use categories to
color code my calendar and would like to save a step by having anything I
mark private automatically assigned to a specific category/color.

Thanks!
 
M

Melissa bone

Hi

I'm no expert, but I recommend you try recording a macro to do this, then
the macro can have a short cut and you should be able to use the shortcut
whilst in your open appointment so instead of having to click the private
button the shortcut makes the appointment private and allocates the category
you previously recorded. I can't test the theory at the moment because the
macro option is locked down at work.
 
S

slapana

Thanks! I'll give that a try, but that won't completely meet my needs. The
larger reason that I asked is because I manually sync my BlackBerry with
Outlook. I can mark appointments private on my BlackBerry, but can't assign
a category; I often end up with uncategorized private appointments because
they were originally created on my BlackBerry and I forget to update the
category in Outlook. I was hoping that there was a way to have Outlook
automatically categorize them for me, but maybe it's not an option...
 
M

Michael Bauer [MVP - Outlook]

S

slapana

Thanks, Michael!! This seems like it should do exactly what I need, but it
doesn't seem to be working. I opened a blank appointment to get to the
Developer tab and then clicked Visual Basic. I added and saved the following
to ThisOutlookSession (changed category name to Personal to match my existing
category):

Private WithEvents Items As Outlook.Items

Private Sub Application_Startup()
Dim Ns As Outlook.NameSpace

Set Ns = Application.GetNamespace("MAPI")
Set Items = Ns.GetDefaultFolder(olFolderCalendar).Items
End Sub

Private Sub Items_ItemAdd(ByVal Item As Object)
If TypeOf Item Is Outlook.AppointmentItem Then
AddCategoryToPrivateAppointment Item
End If
End Sub

Private Sub AddCategoryToPrivateAppointment(Appt As Outlook.AppointmentItem)
If Appt.Sensitivity = olPrivate Then
If Len(Appt.Categories) = 0 Then
Appt.Categories = "Personal"
Appt.Save
End If
End If
End Sub

I then closed Outlook and tried adding a private appointment, but it still
doesn't have a category. The same thing happened with a private appointment
that originated on my Blackberry. :(

What did I mess up?
 
D

Diane Poremsky [MVP]

It may be related to how the appointment is handled by the sync process -
michael uses a windows mobile device which uses active sync. Blackberries
sync using the Desktop manager.

Do you need them categorized or just colored to match the category? if
Private = blue, you can use an automatic formatting rule in a view to color
everything blue that is private. Or, if they need a category, the automatic
formatting rule can color private items with no category so you can easily
identify the items that need a category.

Another option is to run the VBA from a toolbar button after doing the sync.


--
Diane Poremsky [MVP - Outlook]



Outlook Tips by email:
mailto:[email protected]

EMO - a weekly newsletter about Outlook and Exchange:
mailto:[email protected]

Do you keep Outlook open 24/7? Vote in our poll:
http://forums.slipstick.com/showthread.php?t=22205
 
S

slapana

It wasn't working on appointments that I created in Outlook, either, so I'm
not sure that the sync process is entirely to blame for it not working in my
case.

I was hoping there was a simple fix, but I think that I'll just set up
Autoformatting to color code private items without a category for now.

Thanks all for the help!

Diane Poremsky said:
It may be related to how the appointment is handled by the sync process -
michael uses a windows mobile device which uses active sync. Blackberries
sync using the Desktop manager.

Do you need them categorized or just colored to match the category? if
Private = blue, you can use an automatic formatting rule in a view to color
everything blue that is private. Or, if they need a category, the automatic
formatting rule can color private items with no category so you can easily
identify the items that need a category.

Another option is to run the VBA from a toolbar button after doing the sync.


--
Diane Poremsky [MVP - Outlook]



Outlook Tips by email:
mailto:[email protected]

EMO - a weekly newsletter about Outlook and Exchange:
mailto:[email protected]

Do you keep Outlook open 24/7? Vote in our poll:
http://forums.slipstick.com/showthread.php?t=22205

slapana said:
Thanks, Michael!! This seems like it should do exactly what I need, but
it
doesn't seem to be working. I opened a blank appointment to get to the
Developer tab and then clicked Visual Basic. I added and saved the
following
to ThisOutlookSession (changed category name to Personal to match my
existing
category):

Private WithEvents Items As Outlook.Items

Private Sub Application_Startup()
Dim Ns As Outlook.NameSpace

Set Ns = Application.GetNamespace("MAPI")
Set Items = Ns.GetDefaultFolder(olFolderCalendar).Items
End Sub

Private Sub Items_ItemAdd(ByVal Item As Object)
If TypeOf Item Is Outlook.AppointmentItem Then
AddCategoryToPrivateAppointment Item
End If
End Sub

Private Sub AddCategoryToPrivateAppointment(Appt As
Outlook.AppointmentItem)
If Appt.Sensitivity = olPrivate Then
If Len(Appt.Categories) = 0 Then
Appt.Categories = "Personal"
Appt.Save
End If
End If
End Sub

I then closed Outlook and tried adding a private appointment, but it still
doesn't have a category. The same thing happened with a private
appointment
that originated on my Blackberry. :(

What did I mess up?
 
D

Diane Poremsky [MVP]

It works here perfectly for appointments I create in the calendar so I'm
guessing it's something on your end. I pasted the code into
ThisOutlookSession, clicked in the Startup procedure to kick it in and
created a new appointment. Oh - what level of macro security do you have
enabled? I have it set to ask about running macros, which it does when I
start outlook.


--
Diane Poremsky [MVP - Outlook]



Outlook Tips by email:
mailto:[email protected]

EMO - a weekly newsletter about Outlook and Exchange:
mailto:[email protected]

Do you keep Outlook open 24/7? Vote in our poll:
http://forums.slipstick.com/showthread.php?t=22205

slapana said:
It wasn't working on appointments that I created in Outlook, either, so
I'm
not sure that the sync process is entirely to blame for it not working in
my
case.

I was hoping there was a simple fix, but I think that I'll just set up
Autoformatting to color code private items without a category for now.

Thanks all for the help!

Diane Poremsky said:
It may be related to how the appointment is handled by the sync process -
michael uses a windows mobile device which uses active sync. Blackberries
sync using the Desktop manager.

Do you need them categorized or just colored to match the category? if
Private = blue, you can use an automatic formatting rule in a view to
color
everything blue that is private. Or, if they need a category, the
automatic
formatting rule can color private items with no category so you can
easily
identify the items that need a category.

Another option is to run the VBA from a toolbar button after doing the
sync.


--
Diane Poremsky [MVP - Outlook]



Outlook Tips by email:
mailto:[email protected]

EMO - a weekly newsletter about Outlook and Exchange:
mailto:[email protected]

Do you keep Outlook open 24/7? Vote in our poll:
http://forums.slipstick.com/showthread.php?t=22205

slapana said:
Thanks, Michael!! This seems like it should do exactly what I need,
but
it
doesn't seem to be working. I opened a blank appointment to get to the
Developer tab and then clicked Visual Basic. I added and saved the
following
to ThisOutlookSession (changed category name to Personal to match my
existing
category):

Private WithEvents Items As Outlook.Items

Private Sub Application_Startup()
Dim Ns As Outlook.NameSpace

Set Ns = Application.GetNamespace("MAPI")
Set Items = Ns.GetDefaultFolder(olFolderCalendar).Items
End Sub

Private Sub Items_ItemAdd(ByVal Item As Object)
If TypeOf Item Is Outlook.AppointmentItem Then
AddCategoryToPrivateAppointment Item
End If
End Sub

Private Sub AddCategoryToPrivateAppointment(Appt As
Outlook.AppointmentItem)
If Appt.Sensitivity = olPrivate Then
If Len(Appt.Categories) = 0 Then
Appt.Categories = "Personal"
Appt.Save
End If
End If
End Sub

I then closed Outlook and tried adding a private appointment, but it
still
doesn't have a category. The same thing happened with a private
appointment
that originated on my Blackberry. :(

What did I mess up?

:


Outlook has no macro recorder, but some fans who are even better...

This example might work for you; it does for me with my phone and
ActiveSync:
http://www.vboffice.net/sample.html?mnu=2&pub=6&smp=76&cmd=showitem&lang=en

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Wed, 23 Sep 2009 07:44:01 -0700 schrieb slapana:

Thanks! I'll give that a try, but that won't completely meet my
needs.
The
larger reason that I asked is because I manually sync my BlackBerry
with
Outlook. I can mark appointments private on my BlackBerry, but
can't
assign
a category; I often end up with uncategorized private appointments
because
they were originally created on my BlackBerry and I forget to update
the
category in Outlook. I was hoping that there was a way to have
Outlook
automatically categorize them for me, but maybe it's not an
option...

:

Hi

I'm no expert, but I recommend you try recording a macro to do
this,
then
the macro can have a short cut and you should be able to use the
shortcut
whilst in your open appointment so instead of having to click the
private
button the shortcut makes the appointment private and allocates the
category
you previously recorded. I can't test the theory at the moment
because
the
macro option is locked down at work.

:

Is there a way to have Outlook 2007 automatically assign an
appointment
to a
category based on wether or not it's marked private? I use
categories
to
color code my calendar and would like to save a step by having
anything
I
mark private automatically assigned to a specific category/color.

Thanks!
 
M

Michael Bauer [MVP - Outlook]

As Diane suggested, I guess it's due to the macro security. In Outlook (not
VBA environment) click Tools/Macros/Security. You need to set it to one of
the two lower options in order to get it running without a certificate.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Wed, 23 Sep 2009 11:14:02 -0700 schrieb slapana:
 
D

dagwud

'Michael Bauer [MVP - Outlook said:
;77441']Outlook has no macro recorder, but some fans who are even
better...

This example might work for you; it does for me with my phone and
ActiveSync:
http://tinyurl.com/ygqz223

Is it possible to do that "the other way around"? That is, can VBA be
used to mark events private in Outlook 2007 if they are included in a
specific category?

I currently sync 2 calendars with Google, the primary account calendar
and a secondary "family" calendar. But only the primary calendar shows
up in the task pane. I could sync the family calendar information with a
category in the primary calendar, but then all the personal stuff is
available for all who have access to my shared calendar. If the category
were automatically "private" then all would be good.

Or is there some other way to have a category not be completely public
and I just haven't found it yet.
 
M

Michael Bauer [MVP - Outlook]

That's possible as well. A simple solution would look like this:

If Instr(1, Appt.Categories, "your category name", vbTextCompare) Then
Appt.Sensitivity=olprivate
Appt.Save
Endif

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Tue, 27 Oct 2009 10:19:29 -0400 schrieb dagwud:
'Michael Bauer [MVP - Outlook said:
;77441']Outlook has no macro recorder, but some fans who are even
better...

This example might work for you; it does for me with my phone and
ActiveSync:
http://tinyurl.com/ygqz223

Is it possible to do that "the other way around"? That is, can VBA be
used to mark events private in Outlook 2007 if they are included in a
specific category?

I currently sync 2 calendars with Google, the primary account calendar
and a secondary "family" calendar. But only the primary calendar shows
up in the task pane. I could sync the family calendar information with a
category in the primary calendar, but then all the personal stuff is
available for all who have access to my shared calendar. If the category
were automatically "private" then all would be good.

Or is there some other way to have a category not be completely public
and I just haven't found it yet.
 
D

dagwud

Thanks, Michael. I'm apparently in over my head at the moment.

I can get the VBA inserted in "ThisOutlookSession" but I have no idea
where to find the "startup procedure" Diane referenced. And nothing
happens when I create a new appointment in the category, even after
restarting Outlook.

And, yes, I've reduced my Macro settings to dangerously low levels. :D


HTML I can do. VBA, not so mcuh.


'Michael Bauer [MVP - Outlook said:
;88386']That's possible as well. A simple solution would look like
this:

If Instr(1, Appt.Categories, "your category name", vbTextCompare) Then
Appt.Sensitivity=olprivate
Appt.Save
Endif
 
M

Michael Bauer [MVP - Outlook]

Just copy the original code into ThisOUtlookSession, then replace the
mentioned lines of code, then place the cursor in the Application_Startup
procedure, and press f5 to run it once (instead of doing that you could also
restart Outlook).

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>



Am Wed, 28 Oct 2009 10:01:52 -0400 schrieb dagwud:
Thanks, Michael. I'm apparently in over my head at the moment.

I can get the VBA inserted in "ThisOutlookSession" but I have no idea
where to find the "startup procedure" Diane referenced. And nothing
happens when I create a new appointment in the category, even after
restarting Outlook.

And, yes, I've reduced my Macro settings to dangerously low levels. :D


HTML I can do. VBA, not so mcuh.


'Michael Bauer [MVP - Outlook said:
;88386']That's possible as well. A simple solution would look like
this:

If Instr(1, Appt.Categories, "your category name", vbTextCompare) Then
Appt.Sensitivity=olprivate
Appt.Save
Endif
 
D

dagwud

Thanks, Michael. I appreciate the extra attention. This now does exactly
what I want it to do.

Using syncmycal, my work calendar in Outlook syncs with my work
calendar on Google, minus the "Family" category. And my family calendar
on Google syncs with the "Family" category on my work calendar in
Outlook, and the events are marked "private."

So, now all upcoming events show up in my taskpane, since they're all
in my primary calendar.

Fan-flippin-tastic! I'm just pleased as punch!

Derek

'Michael Bauer [MVP - Outlook said:
;88921']Just copy the original code into ThisOUtlookSession, then
replace the
mentioned lines of code, then place the cursor in the
Application_Startup
procedure, and press f5 to run it once (instead of doing that you could
also
restart Outlook).

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>



Am Wed, 28 Oct 2009 10:01:52 -0400 schrieb dagwud:
Thanks, Michael. I'm apparently in over my head at the moment.

I can get the VBA inserted in "ThisOutlookSession" but I have no idea
where to find the "startup procedure" Diane referenced. And nothing
happens when I create a new appointment in the category, even after
restarting Outlook.

And, yes, I've reduced my Macro settings to dangerously low levels. :D


HTML I can do. VBA, not so mcuh.


'Michael Bauer [MVP - Outlook said:
;88386']That's possible as well. A simple solution would look like
this:

If Instr(1, Appt.Categories, "your category name", vbTextCompare) Then
Appt.Sensitivity=olprivate
Appt.Save
Endif
 
M

Michael Bauer [MVP - Outlook]

You're welcome. Thanks for your feedback.

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>


Am Wed, 4 Nov 2009 13:52:26 -0500 schrieb dagwud:
Thanks, Michael. I appreciate the extra attention. This now does exactly
what I want it to do.

Using syncmycal, my work calendar in Outlook syncs with my work
calendar on Google, minus the "Family" category. And my family calendar
on Google syncs with the "Family" category on my work calendar in
Outlook, and the events are marked "private."

So, now all upcoming events show up in my taskpane, since they're all
in my primary calendar.

Fan-flippin-tastic! I'm just pleased as punch!

Derek

'Michael Bauer [MVP - Outlook said:
;88921']Just copy the original code into ThisOUtlookSession, then
replace the
mentioned lines of code, then place the cursor in the
Application_Startup
procedure, and press f5 to run it once (instead of doing that you could
also
restart Outlook).

--
Best regards
Michael Bauer - MVP Outlook

: Outlook Categories? Category Manager Is Your Tool
: VBOffice Reporter for Data Analysis & Reporting
: <http://www.vboffice.net/product.html?pub=6&lang=en>



Am Wed, 28 Oct 2009 10:01:52 -0400 schrieb dagwud:
Thanks, Michael. I'm apparently in over my head at the moment.

I can get the VBA inserted in "ThisOutlookSession" but I have no idea
where to find the "startup procedure" Diane referenced. And nothing
happens when I create a new appointment in the category, even after
restarting Outlook.

And, yes, I've reduced my Macro settings to dangerously low levels. :D


HTML I can do. VBA, not so mcuh.


'Michael Bauer [MVP - Outlook Wrote:
;88386']That's possible as well. A simple solution would look like
this:

If Instr(1, Appt.Categories, "your category name", vbTextCompare) Then
Appt.Sensitivity=olprivate
Appt.Save
Endif
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top