A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Macro to Change sort and collapse groups in Mail folder



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8  
Old January 21st 10, 06:17 PM posted to microsoft.public.outlook.program_vba
Brad
external usenet poster
 
Posts: 78
Default Macro to Change sort and collapse groups in Mail folder

Hi Ken,

Also found this. I made a new view. Am I able to just apply this new view
via VBA?

Thanks,

Brad

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

I do this sort of thing all the time in my addins. I usually grab the XML in
the VBA Immediate window and put it in Notepad for easy editing. I then
modify the view as desired and use the modified XML file as my base for
setting up whatever custom view I want.

For sorting this is the sort of XML you need:

orderby
order
headingReceived/heading
propurn:schemas:httpmail:datereceived/prop
typedatetime/type
sortdesc/sort
/order
/orderby

You can have up to 3 sort fields within that orderby tag. Properties are
identified using DASL property tags, so you need to pick those up for your
view properties. You can also set grouping using tags for that.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Michael Bauer [MVP - Outlook]" wrote in message
...


I haven't played with it myself. However, this prints the current view
definition into the debug window:

Debug.Print Application.ActiveExplorer.CurrentFolder.CurrentVi ew.Xml

I'd play with the folder view, print CurrentView.Xml, and see what
changes.
If you have found how to define the settings you're looking for, you can
edit the xml property. See also the Apply, and the Save method of the View
object.

--
Best regards
Michael Bauer - MVP Outlook
Manage and share your categories:
http://www.vboffice.net/product.html?pub=6&lang=en


.

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you collapse all groups without scrolling to end? Greg S Outlook - Using Contacts 3 July 7th 09 02:17 AM
collapse a specific mail folder from a macro in Outlook 2007 udo Outlook and VBA 6 February 5th 09 08:26 AM
collapse a specific mail folder from a macro in Outlook 2007 udo Outlook - General Queries 2 February 2nd 09 02:08 PM
OL2007 Collapse All Groups Christine Lisi Outlook - Using Contacts 4 March 13th 08 12:48 PM
Collapse groups programmatically Rafael Outlook - Using Forms 0 May 22nd 07 04:21 PM


All times are GMT +1. The time now is 06:43 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.