Outlook 2016 VBA - Run Clean Up Folder via code

拥有回忆 提交于 2020-06-29 10:35:49

问题


I am trying to put code into Outlook VBA where I can loop through all my offline folders and run the "Clean Up Folder & Subfolders" menu command on each folder. I have tried several items and cannot get anything to work. There is very little online and no working code. All suggestions point to Application.CommandBars.ExecuteMso ("ThreadCompressFolderRecursive"), but that object does not exist. Any Ideas?


回答1:


Not the Application. Use Inspector or Explorer as required.

Sub ExecuteMso_CleanUP()

    Dim objExpl As Explorer

    Set objExpl = ActiveExplorer
    objExpl.CommandBars.ExecuteMso ("ThreadCompressFolderRecursive")

End Sub


来源:https://stackoverflow.com/questions/44553378/outlook-2016-vba-run-clean-up-folder-via-code

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!