ActiveExplorer.CurrentFolder.Views("J VIEW").Apply
--
Alan Moseley IT Consultancy
http://www.amitc.co.uk
If I have solved your problem, please click Yes below. Thanks.
"Jeremy" wrote:
Alan,
Thanks for the code. It's very helpful.
I wantedto loop through all my folders and apply a specified view. Adapting
your code I have the following:
Public Sub ProcessAllFolders()
Dim fld As MAPIFolder
For Each fld In Application.GetNamespace("MAPI").Folders
Call ProcessFolder(fld)
Next fld
End Sub
Public Sub ProcessFolder(ByRef fld As MAPIFolder)
Dim subfld As MAPIFolder
'do something here
Application.ActiveExplorer.CurrentView = "J VIEW"
For Each subfld In fld.Folders
Call ProcessFolder(subfld)
Next subfld
End Sub
I understand I need to get the current view as an object and apply it but
I'm not sure of the code. If you're inclined to any further help I do
appreciate it!
Thanks
"Alan Moseley" wrote:
You just need to start your search higher up the folder tree eg.
Public Sub ProcessAllFolders()
Dim fld As MAPIFolder
For Each fld In Application.GetNamespace("MAPI").Folders
Call ProcessFolder(fld)
Next fld
End Sub
Public Sub ProcessFolder(ByRef fld As MAPIFolder)
Dim subfld As MAPIFolder
'Do Something here
For Each subfld In fld.Folders
Call ProcessFolder(subfld)
Next subfld
End Sub
--
Alan Moseley IT Consultancy
http://www.amitc.co.uk
If I have solved your problem, please click Yes below. Thanks.
"Jeremy" wrote:
Hi,
I would like to cycle through every folder in my mailbox and I have the
following code. However, i don't think this code will cycle through all
folders, I think it just cycles through those under my inbox. I don't think
the macro will cycle through folders located under .pst archives, or other
mailboxes that I have access to under my mailbox.
Is there a way a cycling through all folders, including those under other
mailboxes and archives?
My current macro is as follows:
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
'insert some code here to do something
For Each olkSubFolder In olkFolder.Folders
ProcessSubFolder olkSubFolder
Next
Set olkSubFolder = Nothing
End Sub