K
Keith G Hicks
I'm trying to run "GlobalDisableShowInGroups" - this routine was posted
somewhere (I don't remember where) and it gets rid of the annoying grouping
of messages in outlook 2003. The trouble I'm having is that I don't see how
to apply it to my own folders. IN the line "Set
mapiFolderForDisablingGroups =
ns.GetDefaultFolder(olPublicFoldersAllPublicFolders)" there are no
parameters that work to handle ALL my own folders. I have dozens of folders
under "Personal Folders" and each of those can have many subfolders. How do
I tell this code to operate on ALL of the folders I created???
Thanks,
Keith
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)
'added by me for my own folders
Dim mapiFolderForDisablingGroups As MAPIFolder
Set mapiFolderForDisablingGroups =
ns.GetDefaultFolder(olPublicFoldersAllPublicFolders)
TreeDisableShowInGroups mapiFolderForDisablingGroups
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
somewhere (I don't remember where) and it gets rid of the annoying grouping
of messages in outlook 2003. The trouble I'm having is that I don't see how
to apply it to my own folders. IN the line "Set
mapiFolderForDisablingGroups =
ns.GetDefaultFolder(olPublicFoldersAllPublicFolders)" there are no
parameters that work to handle ALL my own folders. I have dozens of folders
under "Personal Folders" and each of those can have many subfolders. How do
I tell this code to operate on ALL of the folders I created???
Thanks,
Keith
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)
'added by me for my own folders
Dim mapiFolderForDisablingGroups As MAPIFolder
Set mapiFolderForDisablingGroups =
ns.GetDefaultFolder(olPublicFoldersAllPublicFolders)
TreeDisableShowInGroups mapiFolderForDisablingGroups
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