Error: Object not Found.觸發宏到特定文件夾的電子郵件
MyEmailAddress有一個名爲CL的文件夾,當有什麼東西時,我想要一個名爲「InsertData」的宏來運行。
Dim E_flge As Byte
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim NS As Outlook.NameSpace
Dim MyMail As Object
Set NS = Application.GetNamespace("MAPI")
Set MyMail = NS.GetItemFromID(EntryIDCollection)
E_flge = 0
If MyMail.Class = olMail Then
If MyMail.Parent.Parent = "MyEmailAddress" Then
InsertData 'Macro I am trying to call
End If
End If
End Sub
http://stackoverflow.com/questions/2573597/should-i-use-call-keyword-in-vb-vba http://stackoverflow.com嘗試ItemAdd/questions/2573597/should-i-use-call-keyword-in-vb-vba/2582064#2582064「我總是在VBA中使用Call。對我來說,它看起來更乾淨。但是,我同意,這只是句法糖,它正是個人偏好的領域。在過去的幾年中,我遇到過大概十幾個全職VBA傢伙,而且他們中沒有一個使用過Call。這必須增加優勢,我一直知道哪個代碼是我的。 :p尼克「 – niton