A
Aaron
I am trying to write my first Outlook VBA code (I have written VBA in Excel
and Access so far) that triggers on a certain rule. In order to check to see
if the code is even firing, I have tried to create a simple message box that
shows the Sender string from a MailItem. However, know that the rule should
trigger, I still don't see any message box. I have check my security
settings, and they are set to allow all macro codes with a warning. Thank
you for any advice/help!
The rule and code are as follows:
Rule:
Apply this rule after the message arrives through xxx account run
Scripts.Test2
Code:
Option Explicit
Public Sub Test2(myMailItem As Outlook.MailItem)
Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim colFolders As Outlook.Folders
Dim objFolder As Outlook.Folder
Dim arrFolders() As String
Dim Sender As String
Dim Response As String
Set objApp = Application
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = objNS.Folders.item("ITCS (POP)\Inbox")
Sender = myMailItem.To
Response = MsgBox(Sender, vbYesNo, "Sender")
End Sub
and Access so far) that triggers on a certain rule. In order to check to see
if the code is even firing, I have tried to create a simple message box that
shows the Sender string from a MailItem. However, know that the rule should
trigger, I still don't see any message box. I have check my security
settings, and they are set to allow all macro codes with a warning. Thank
you for any advice/help!
The rule and code are as follows:
Rule:
Apply this rule after the message arrives through xxx account run
Scripts.Test2
Code:
Option Explicit
Public Sub Test2(myMailItem As Outlook.MailItem)
Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim colFolders As Outlook.Folders
Dim objFolder As Outlook.Folder
Dim arrFolders() As String
Dim Sender As String
Dim Response As String
Set objApp = Application
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = objNS.Folders.item("ITCS (POP)\Inbox")
Sender = myMailItem.To
Response = MsgBox(Sender, vbYesNo, "Sender")
End Sub