Автоматизация
0
Вклад в тег
Public WithEvents myOlItems As Outlook.Items
Public Sub Application_Startup()
Set myOlItems = Outlook.Session.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub myOlItems_ItemAdd(ByVal Item As Object)
If (WeekDay(checkindate) = 1 or 7) or (Time() < #9:00:00 AM# Or Time() > #5:00:00 PM#) Then
If TypeName(Item) = "MailItem" Then
Set myForward = Item.Forward
myForward.Recipients.Add "support@domen.ru"
myForward.Send
End If
End If
End Sub