有人可以帮我解决我试图在 VBA 中实现的这个小脚本吗?
附加的是循环随机停止,我无法移动“存档”文件夹中的所有邮件。
Private Sub aggiorna_click()
Dim x As Object
Dim ns As Outlook.NameSpace
Dim itm, sgsa, actionPlan, cartella, specCartella As Object
Dim olDestFolder As Outlook.MAPIFolder
Set ns = GetNamespace("MAPI")
Set itm = ns.GetDefaultFolder(olFolderInbox)
Set sgsa = itm.Folders("SGSA")
Set actionPlan = sgsa.Folders("action plan")
Set cartella = actionPlan.Folders(tipo.Text)
Set specCartella = cartella.Folders(piano.Text)
Set olDestFolder = itm.Folders("archivio")
For Each x In specCartella.Items
x.Move olDestFolder
Next x
End Sub