That's why I suggested to create your own view and apply it on first use of
the folder. This is a lot less time consuming then troubleshooting it ;-)
You might want to use this code if you really don't want to define your own
view;
'------------------------------------------------------------------
' GlobalDisableShowInGroups - version 1.0
'
' this macro recursively goes through Inbox and all its subfolders
' and disables the annoying "Show in Groups" in Outlook 2003
' You'll see some Outlook instances popping up, but that's ok
'
' (c) Silly Software, 2004
Sub GlobalDisableShowInGroups()
Dim ns As NameSpace
Dim Inbox As MAPIFolder
Set ns = GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFolderInbox)
TreeDisableShowInGroups Inbox
'.....add your own top level Folders here (not subfolders)
End Sub
Public Sub TreeDisableShowInGroups(oFolder As Outlook.MAPIFolder)
Dim oSubFolder As Outlook.MAPIFolder
Dim oCB As Office.CommandBar
Dim oPop As Office.CommandBarPopup
Dim oCtl As Office.CommandBarControl
Dim objExpl As Outlook.Explorer
'open folder in new outlook instance
oFolder.Display
'find state of "Show in Groups"
'NOTE: For WindowsXP in Dutch language, substitute "View" with
"Beeld",
'"Arrange by" with "Rangschikken op" and "Show in groups" with
"Weergeven in groepen"
Set oCB = Application.ActiveExplorer.CommandBars("Menu Bar")
Set oPop = oCB.Controls("View")
Set oPop = oPop.Controls("Arrange by")
Set oCtl = oPop.Controls("Show in groups")
st = oCtl.State
'if state is ON than change it by executing it
If (st = -1) Then
oCtl.Execute
End If
'close instance of outlook
oFolder.GetExplorer.Close
'Now recursively call any subfolders
For Each oSubFolder In oFolder.Folders
TreeDisableShowInGroups oSubFolder
Next
'Release objects
Set oSubFolder = Nothing
End Sub
'------------------------- end ------------------------------
--
Robert Sparnaaij [MVP-Outlook]
www.howto-outlook.com
Tips of the month:
-Navigation Pane Tips & Tricks
-Create an Office 2003 CD slipstreamed with Service Pack 1