Setting up automated Layouts for viewing email

  • Thread starter Thread starter BigDocD
  • Start date Start date
B

BigDocD

I'd like to set up a VBA macro that when run will check and reset all mail
viewing layouts for all my .pst files, both Personal Folders and Archives. I
find that when I manually add a new folder, for example, it defaults back to
what seems to be an Outlook Standard layout for viewing email. I then have
to go in and reset it by hand. This also happens during archiving -- if the
archive program sets up and copies archived messages to a folder it creates,
the viewing options are now back to this aforementioned seeming standard. I
deal with thousands of stock market tickers I track, so the manual reset
seems to take all my time.

For example, I first right-click in a new folder I've just created and go to
"Customize Current View". Then I select "Other Settings" and then click
"Reading Pane OFF", ok, ok. Then I move and adjust the columns the way I
want them. Then I right-click on the date (Received, Send, etc.) and go to
"Arrange BY" and click "Date" and then click to turn off "Show in Groups".

I'd like to be able to invoke a macro that would ask me the .pst filename,
then would chase all the folders in the file to ensure that the mail folders
are formatted as I've discussed, hopefully in the background so I can
continue to work.
 
What your code would need to do is to capture the existing custom view you
want and apply the view XML to all the other folders. Take a look here for
an example of creating and applying a custom view:
http://www.outlookcode.com/threads.aspx?forumid=4&messageid=19

Your code will run in the foreground, so be prepared to wait while it runs.

Why not just create the custom view you want and set the setting for having
it available for all folders of that type? Then you just have to select that
view in the views dropdown. You'd just have to capture it once for each PST
file and apply it, then it would be available for all folders in that PST
file.
 
Thanks for responding so fast, Ken. I see your example address came up to
Sue Mosher's reference site. I have her latest book in my "To Read" file.
Maybe I'll understand the example after I do that.

Your suggestion about creating a custom view would be fine except that I
can't find any reference as to how to apply it to a whole .pst file. I've
tried doing that a couple of ways and it turns out fine for the root folder,
but not the subfolders.

Perhaps you could explain specifically how I do that application of the
custom view.

Al
 
Every folder has a Views collection. Once you have the view XML as a string
you can add the view to the Views collection of every folder and then
Apply() that view as the current folder view. Of course you have to Save()
the view after you add it to the Views collection. You'd have to traverse
the folder hierarchy to do that for every folder in a PST file. Sue's book
and Web site have examples of traversing a folder hierarchy.

I find it easiest to create my views in the UI and then extract the view XML
for re-use in the code. Then I tweak the view XML.

Some things like autoformatting can't be applied using view XML.
 
Back
Top