用于调用“清理文件夹”的 VBA 代码在 Outlook 2010 中?
有谁知道右键单击文件夹时调用右键菜单上的“清理文件夹”Outlook 2010 命令的 VBA 代码?
我已经在 VBA 代码中找到了我想要清理的文件夹:
Private Sub CleanUpAllFolders()
Dim Folders As Outlook.Folders
Dim Folder As Outlook.Folder
Set Folders = Session.GetDefaultFolder(olFolderInbox).Parent.Folders
For Each Folder In Folders
If Left(Folder.Name, 1) = "_" Then
' Clean up folder... how do I invoke that command from VBA on this folder?
End If
Next
End Sub
但是,我在文件夹对象本身上看不到任何可以让我调用“清理文件夹”的方法。
如何在 VBA 中当前选定的文件夹上调用这些右键菜单命令之一?
Does anyone know the VBA code to invoke the "Clean Up Folder" Outlook 2010 command on the right-click menu when right-clicking on a folder?
I have gotten this far in VBA code to get to the folders I want to clean up:
Private Sub CleanUpAllFolders()
Dim Folders As Outlook.Folders
Dim Folder As Outlook.Folder
Set Folders = Session.GetDefaultFolder(olFolderInbox).Parent.Folders
For Each Folder In Folders
If Left(Folder.Name, 1) = "_" Then
' Clean up folder... how do I invoke that command from VBA on this folder?
End If
Next
End Sub
However, I can't see any method on the Folder object itself that lets me invoke "Clean Up Folder".
How do I invoke one of those right-click menu commands on the current selected folder in VBA?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我无法对此进行测试,但从我读到的内容来看,这可能有效。
首先找到命令的 idMso 值。使用此查找值:
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=3582" microsoft.com/download/en/details.aspx?displaylang=en&id=3582
然后使用
Application.CommandBars.ExecuteMso(idMso)
执行命令。祝你好运。I am unable to test this, but from what I read this might work.
First find the idMso value for the command. Use this to find the value:
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=3582
Then use
Application.CommandBars.ExecuteMso(idMso)
to execute the command. Good luck.