Filling a UserForm ComboBox with Calendar items

D

devlei

I would like to be able to do the following:
1. Fill a ComboBox on a UserForm with items filtered by "Location" and
"Category" from the Calendar folder. The values for these two filtered
fields are acquired from two text fields that are also on the UserForm.
2. Then double-click an item in the ComboBox to have that item opened
for editing.

Can someone please help a newbie?
 
J

Jim Vierra

Why not just use the "Advanced Find" dialog. It already has all of these
items and more.
 
S

Sue Mosher [MVP-Outlook]

1) For this, you can use the MAPIFolder.Items.Find or Items.Restrict method
to search for the appointments you want. (The VBA Help topics on both show
how to use them.) Restrict is somewhat easier, but not recommended if you
are pulling information from a public folder.

2) The easiest way to make this work with the DoubleClick event handler is
to set up your control with two columns, one hidden. In the second column,
put the EntryID for each appointment. That way, you can use the
Namespace.GetItemFromID method with the EntryID value to return the precise
item you want. For this purpose, the easiest way to populate the combo box
will be to gather the Subject and EntryID for each appointment into a
2-dimensional array and then set the combo box's List property to that
array.
 
J

Jim Vierra

Too bad we don't have direct access to the Dialogs like the WIndows Common
Dialogs.

Thanks Sue - I knew you had a better way. The problem with Find and
Restrict is that they cannot use "Categories" in the filter. "Location"
works fine but we still have to hand code the check for the category.

In this case I would try get my users to use the Advanced Find.
 
S

Sue Mosher [MVP-Outlook]

Don't believe everything that Help tells you, at least not until you try it.
I've never had any problems using Categories with Find or Restrict.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
J

Jim Vierra

Do you have an example of the exact sytntax. When I ues it I get an error
saying it's not supported on Appointment Items. I wonder what could be
different that allows your code to get by?
 
J

Jim Vierra

"[Categories] = 'Favorites' OR [Categories] = 'Holiday' OR [Categories] =
'Gifts'")

Very touchy syntax. doesn't like "LIKE" or "IN" just AND/OR = <> etc.
 
D

devlei

Thanks Sue & Jim

I need a solution that will run on both desktop and handheld and look
similar therefore can't use user defined fields, but have manipulate
data from the standard fields. For this reason the "Advanced Find" is
not going to provide the solution.
 

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