akribie
02-26-2017, 05:19 AM
Hi,
I have many email accounts in Outlook 2010 and am looking for a way to automate collapsing mail folders in the Folder pane which insist on opening whenever a new email arrives for that account. I use favourite folders to offset this problem, but it is still a pain to have many folders open each with many open sub-folders.
Starting with Personal Folders at the top of the list, repetitive manual keystrokes of LEFT and DOWN have the desired result.
However,, the equivalent macro:
Sub CollapseFolders()
Application.SendKeys "{LEFT}{DOWN}", True
Application.SendKeys "{LEFT}{DOWN}", True
End Sub
fails with "Object does not support this property or method", whereas these versions:
Sub CollapseFolders()
SendKeys "{LEFT}{DOWN}", True
SendKeys "{LEFT}{DOWN}", True
End Sub
Sub CollapseFolders()
SendKeys "{LEFT}{DOWN}"
SendKeys "{LEFT}{DOWN}"
End Sub
compile OK, but achieve nothing.
I am aware that many internet answers suggest this task is not automatable, but it isn't obvious to me why this code should not work.
Grateful for any hints or explanations as to why the MS documentation does not mention any relevant restrictions.
Thanks !
I have many email accounts in Outlook 2010 and am looking for a way to automate collapsing mail folders in the Folder pane which insist on opening whenever a new email arrives for that account. I use favourite folders to offset this problem, but it is still a pain to have many folders open each with many open sub-folders.
Starting with Personal Folders at the top of the list, repetitive manual keystrokes of LEFT and DOWN have the desired result.
However,, the equivalent macro:
Sub CollapseFolders()
Application.SendKeys "{LEFT}{DOWN}", True
Application.SendKeys "{LEFT}{DOWN}", True
End Sub
fails with "Object does not support this property or method", whereas these versions:
Sub CollapseFolders()
SendKeys "{LEFT}{DOWN}", True
SendKeys "{LEFT}{DOWN}", True
End Sub
Sub CollapseFolders()
SendKeys "{LEFT}{DOWN}"
SendKeys "{LEFT}{DOWN}"
End Sub
compile OK, but achieve nothing.
I am aware that many internet answers suggest this task is not automatable, but it isn't obvious to me why this code should not work.
Grateful for any hints or explanations as to why the MS documentation does not mention any relevant restrictions.
Thanks !