Hi Simon
Another option in 2002 & 2003 (2000 is a little bit trickier as you will
need to download the actual control from MS) is to use the standard Outlook
dll (the Outlook View Control). You insert the Outlook View Control ActiveX
into a form and all your Outlook folders are there for you to manipulate.
Here is an example:
These are the steps to create a form with the OVC but please note that this
applies only in 2003 as Outlook in 2000 & 2002 has slightly different views
so the code would need to be changed for the Outlook 2000 & 2002 views (i.e.
the code lines that say Me!ctlView.RowSource = ).
1. Create a new form
2. Add a combo box and
- rename it to cboViewType
- Row Source Type is Value List
- Assuming your Outlook installation's default view is Inbox insert as
the Row Source "Messages";"Messages with AutoPreview";"Unread messages in
this folder";"Sent To";"Message Timeline"
3. Add an option group of 6 buttons containing
- an option value of 1 through to 6
- captions of Email, Calendar, Tasks, Contacts, Notes and Sent
- rename the option group to optOutlookView
4. Add the Outlook View ActiveX control and rename it to ctlOutlookView
5. Add the following code to the AfterUpdate property of the combo box
called cboViewType:
Me!ctlOutlookView.View = Me!cboViewType
6. Add the following code to the OnClick property of the option group called
optOutlookView:
Select Case Me!optView
Case 1
Me!OutlookView.Folder = "Inbox"
Me!OutlookView.SetFocus
Me!subHomeDiscussion.Visible = False
Me!ctlView.RowSource = "'Messages';'Messages with AutoPreview';" & _
"'Unread Messages in This Folder';'Sent To';'Message Timeline'"
Me!ctlView = Me!OutlookView.View
Case 2
Me!OutlookView.Folder = "Calendar"
Me!OutlookView.SetFocus
Me!subHomeDiscussion.Visible = False
Me!ctlView.RowSource = "'Day/Week/Month';'Day/Week/Month View " & _
"With AutoPreview';'Active Appointments';'Events';'Annual
Events';" & _
"'Recurring Appointments';'By Category'
Me!ctlView = Me!OutlookView.View
Case 3
Me!OutlookView.Folder = "Tasks"
Me!OutlookView.SetFocus
Me!subHomeDiscussion.Visible = False
Me!ctlView.RowSource = "'Simple List';'Detailed List';'Active
Tasks';'Next Seven " & _
"Days';'Overdue Tasks';'By Category';'Assignment';'By Person
Responsible';" & _
"'Completed Tasks';'Task Timeline'"
Me!ctlView = Me!OutlookView.View
Case 4
Me!OutlookView.Folder = "Contacts"
Me!OutlookView.SetFocus
Me!subHomeDiscussion.Visible = False
Me!ctlView.RowSource = "'Address Cards';'Detailed Address
Cards';'Phone List';" & _
"'By Category';'By Company';'By Location';'By Follow-up Flag'"
Me!ctlView = Me!OutlookView.View
Case 5
Me!OutlookView.Folder = "Notes"
Me!OutlookView.SetFocus
Me!subHomeDiscussion.Visible = False
Me!ctlView.RowSource = "'Icons';'Notes List';'Last Seven Days';'By
Category';'By Color'"
Me!ctlView = Me!OutlookView.View
Case 6
Me!OutlookView.Folder = "Sent Items"
Me!OutlookView.SetFocus
Me!subHomeDiscussion.Visible = False
Me!ctlView.RowSource = "'Messages';'Messages with AutoPreview';" & _
"'Last Seven Days';'Unread Messages in This Folder';'Sent
To';'Message Timeline'"
Me!ctlView = Me!OutlookView.View
Case 7
Me!subHomeDiscussion.Visible = True
Me!subHomeDiscussion.SetFocus
Me!ctlView.RowSource = ""
Me!ctlView = ""
Me!subHomeDiscussion.Requery
End Select
Use the form by selecting one of the main outlook folders by the option
group buttons and then changing the views by selecting one of the views in
the combo box.
Notes:
1. The views have been taken from the standard Outlook views so the views in
the above code would need to be changed when using Outlook 2000 or 2002
4. An example of how we use this control in an application can be found in
our Jackaroo IT application (Access 2000 and 2002) which can be downloaded
from our web site at
http://jackaroo.net.au and selecting Use Outlook on the
User Options form.
The control's help file can be downloaded at
http://www.microsoft.com/downloads/...FamilyID=831F957F-3190-48DA-A099-2BDBC7397623
Hope this helps