How to programmatically switch to "Group By" view in Outlook

K

Kirk

I would like to programmatically (VB) switch the current view to "Group
by - Category". I know I can do this by using the settings in Outlook,
but I have my reasons for wanting to do this via VB. Basically, when I
click a header to resort by that field, I want to create another button
that reverts back to the "Group by" view on a single click.

I have seen some similar posts regarding this issue, but I have yet to
see one that posted really useful information, such as sample code or
just some keywords or concepts to research in the Outlook VBA helpfile.

I would greatly appreciate any suggestions or links that anyone could
give me.
Thanx!
 
K

Kirk

Thanks for your quick response. Unfortuately, I don't think this
solution will help me.

Your response dealt with "views" in Outlook. I know how to switch
views like this:

Sub ChangeView(strViewName)
Dim objOL
Set objOL = CreateObject("Outlook.Application")
objOL.ActiveExplorer.CurrentView = strViewName
Set objOL = Nothing
End Sub

MY problem is how to change to the "Group By" view of categories. My
method will switch to the correct view, but it does not remember or set
the "Group By" arrangement. Please let me know if you can guide me
further.

Thanx!
 
E

Eric Legault [MVP - Outlook]

To change the properties of a specific view, you have to manipulate the XML
in the View.XML property. It can be a little daunting, but these articles
can set you on the right track:

Creating Custom Views (Microsoft Outlook 2002 Technical Articles):
http://msdn.microsoft.com/library/en-us/dnout2k2/html/ODC_CustomViews.asp?frame=true

XML View Definitions (Microsoft Outlook 2002 Technical Articles):
http://msdn.microsoft.com/library/en-us/dnout2k2/html/ODC_XMLViewDef.asp?frame=true

There is also a View Manipulation.zip file containing sample code on
http://www.OutlookCode.com somewhere, but I can't find it. Sue?
 

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