J
Jeremy
Hi,
I'm using Outlook 2007 and that version of VB.
I have an awful lot of folders and I wanted to set each to a particular
custom view. I have written the code below to go through each folder and set
the custom view. However, it does not do this. I think I may need to "save"
after Application.ActiveExplorer.CurrentView = "J VIEW" however, I do not
know how to do this and keep getting an object error. Could someone help.
(As you might realise I want to set the custom view for all folders. I have
not found a macro to do this. I have tried cleaning the custom views using
"outlook.exe /cleanviews" and then changing the "messages" the default view -
this does not work and in fact "outlook.exe /cleanviews" does not properly
reset the "messages" view - different folders have different views despite
being set to the "messages" view.)
My code (pieced together as I can't program):
Sub ProcessAllFolders()
ProcessSubFolder Application.ActiveExplorer.CurrentFolder
MsgBox "All Done!", vbInformation + vbOKOnly, "Process All Folders Macro"
End Sub
Sub ProcessSubFolder(olkFolder As Outlook.MAPIFolder)
Dim olkSubFolder As Outlook.MAPIFolder
'Replace the following line with the code you want to run for each folder
'Debug.Print olkFolder.FolderPath
Application.ActiveExplorer.CurrentView = "J VIEW"
For Each olkSubFolder In olkFolder.Folders
ProcessSubFolder olkSubFolder
Next
Set olkSubFolder = Nothing
End Sub
I'm using Outlook 2007 and that version of VB.
I have an awful lot of folders and I wanted to set each to a particular
custom view. I have written the code below to go through each folder and set
the custom view. However, it does not do this. I think I may need to "save"
after Application.ActiveExplorer.CurrentView = "J VIEW" however, I do not
know how to do this and keep getting an object error. Could someone help.
(As you might realise I want to set the custom view for all folders. I have
not found a macro to do this. I have tried cleaning the custom views using
"outlook.exe /cleanviews" and then changing the "messages" the default view -
this does not work and in fact "outlook.exe /cleanviews" does not properly
reset the "messages" view - different folders have different views despite
being set to the "messages" view.)
My code (pieced together as I can't program):
Sub ProcessAllFolders()
ProcessSubFolder Application.ActiveExplorer.CurrentFolder
MsgBox "All Done!", vbInformation + vbOKOnly, "Process All Folders Macro"
End Sub
Sub ProcessSubFolder(olkFolder As Outlook.MAPIFolder)
Dim olkSubFolder As Outlook.MAPIFolder
'Replace the following line with the code you want to run for each folder
'Debug.Print olkFolder.FolderPath
Application.ActiveExplorer.CurrentView = "J VIEW"
For Each olkSubFolder In olkFolder.Folders
ProcessSubFolder olkSubFolder
Next
Set olkSubFolder = Nothing
End Sub