0
我嘗試使宏在VBA中完成一些操作後自動更改電子郵件類別。如何使用VBA更改MS Outlook 2013中的電子郵件類別?
我創造了一些代碼,看起來不錯,但有它的問題,並不總是工作 - 有時類別不改變,它看起來就像是與它的錯誤:
Dim myolApp As Outlook.Application
Dim olFolder As Outlook.MAPIFolder
Dim ns As Outlook.NameSpace
Set ns = Outlook.GetNamespace("MAPI")
Set myolApp = CreateObject("Outlook.Application")
Set olFolder = ns.GetDefaultFolder(olFolderInbox)
Set olFolder = myolApp.ActiveExplorer.CurrentFolder
Dim itm As Object
Dim mailcattable As Variant
Dim kategoria As String
For Each itm In olFolder.Items
For b = 0 To UBound(mailcattable)
If mailcattable(b) = "ABCD" Then
mailcattable(b) = "After ABCD"
kategoria = Join(mailcattable, "; ")
itm.Categories = kategoria
End If
Next
Next
你能告訴我如何解決它?
謝謝!重置「kategoria」變量真的有幫助! – RobRaj