Hello everyone,
I want to write a script that combines ThisOutlookSession and module.
For example currently I have the below script in ThisOutlookSession
Sub AutoForwardAllSentItems(Item As Outlook.MailItem)
Dim strMsg As String
Dim myFwd As Outlook.MailItem
Set myFwd = Item.Forward
myFwd.Recipients.Add ""A@f.com""
myFwd.Recipients.Add ""B@f.com""
xStr1 = ""<p>A</p>""
xStr2 = ""<p>B</p>""
myFwd.HTMLBody = xStr1 & xStr2 & Item.HTMLBody
myFwd.Send
Set myFwd = Nothing
End Sub"
Could you help me how to write in ThisOutlookSession so that
If condition A, run module 1
If condition B, run module 2
Module 1
Sub AutoForwardAllSentItems(Item As Outlook.MailItem)
Dim strMsg As String
Dim myFwd As Outlook.MailItem
Set myFwd = Item.Forward
myFwd.Recipients.Add ""A@f.com""
xStr1 = ""<p>A1</p>""
xStr2 = ""<p>A2</p>""
myFwd.HTMLBody = xStr1 & xStr2 & Item.HTMLBody
myFwd.Send
Set myFwd = Nothing
End Sub
Module 2
Sub AutoForwardAllSentItems(Item As Outlook.MailItem)
Dim strMsg As String
Dim myFwd As Outlook.MailItem
Set myFwd = Item.Forward
myFwd.Recipients.Add ""B@f.com""
xStr1 = ""<p>B1</p>""
xStr2 = ""<p>B2</p>""
myFwd.HTMLBody = xStr1 & xStr2 & Item.HTMLBody
myFwd.Send
Set myFwd = Nothing
End Sub