|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
老师您好,代码如下,应该是红色那句出了问题,谢谢
(1)请教老师,该如何修改?
(2)如果我想将目前满足条件的邮件转入之前已归档(archive)的,名称是2016.pst的inbox中改如何操作?谢谢老师
Sub 按钮1_Click()
Dim myOlApp As Object
Dim myNameSpace As Object
Dim myDrafts As Object
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myDrafts = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myDest = myNameSpace.Folders("aa")
Dim mi As MailItem
For Each mi In myDrafts.Items
If mi.FlagStatus = olFlagMarked Then
mi.Move myDest
End If
Next
Set myOlApp = Nothing
Set myNameSpace = Nothing
Set myDrafts = Nothing
Set myDest = Nothing
End Sub |
|