A
andreas gammel
hi
I just wrote the following little macro, that solves the problem of
the very annoying 'Show in Groups' feature in Outlook 2003. It assumes
that all your folders are subfolders of the Inbox. I think it can be
easily altered to work for all folders, but I've had enough. It works,
so its fine. The strings "View", "Arrange by" and "Show in groups"
should be in the language of the Windows version you are using. I
supplied the English and Dutch strings. It recursively goes down the
entire tree of subfolders you may have. For each folder you'll see a
quick popup of an Outlook instance. Could be better but it works. Just
wait and see. The trick is to display each folder and than directly
send a menu command using the CommandBars collection.
cheers
Andreas
'------------------------------------------------------------------
' 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 ------------------------------
I just wrote the following little macro, that solves the problem of
the very annoying 'Show in Groups' feature in Outlook 2003. It assumes
that all your folders are subfolders of the Inbox. I think it can be
easily altered to work for all folders, but I've had enough. It works,
so its fine. The strings "View", "Arrange by" and "Show in groups"
should be in the language of the Windows version you are using. I
supplied the English and Dutch strings. It recursively goes down the
entire tree of subfolders you may have. For each folder you'll see a
quick popup of an Outlook instance. Could be better but it works. Just
wait and see. The trick is to display each folder and than directly
send a menu command using the CommandBars collection.
cheers
Andreas
'------------------------------------------------------------------
' 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 ------------------------------