I'm new in the ways of VBA and I want to create a rule (script) that can automatically forward an email received in my Outlook inbox with a specified delay? Can you please give me some instructions on how can I achieve this?
I tried:
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMiliseconds As Long)
Sub send(Item As Outlook.MailItem)
Set fwd = Item.Forward
fwd.Recipients.Add "mail@email.com"
Sleep (10000)
fwd.send
End Sub
Also tried:
Sub WasteTime(Finish As Long)
Dim NowTick As Long
Dim EndTick As Long
EndTick = GetTickCount + (Finish * 1000)
Do
NowTick = GetTickCount
DoEvents
Loop Until NowTick >= EndTick
End Sub
Sub send(Ite As Outlook.mailItem)
Set fwd = Item.Forward
fwd.Recipients.Add "mail@email.com"
WasteTime (10)
fwd.send
End Sub
to no effect.
The 2nd code actually freezes my entire Outlook app which is not my desired effect. I only want to delay the re-sending of the email...