T
Tom Ha via OfficeKB.com
Hello, I have this code in outlook to send 2 emails 1 minute apart from
each other:
Sub ServerTestingMacro()
'Macro Name will show as ServerTestingMacro
'Create 1st email to start escalation and send it
Set objNewEmail = Application.CreateItem(olMailItem)
With objNewEmail
.Subject = ""
.Body = ""
.To = "(e-mail address removed)"
.Send
End With
Set objNewMail = Nothing
'Wait a minute
lngTimeStart = Timer()
Do
'The DoEvents line prevents Outlook from locking up for the minute
DoEvents
lngTimeStop = Timer()
If (lngTimeStop - lngTimeStart) > 60 Then Exit Do
Loop
'Create 2nd email to acknowledge escalation and send it
Set objNewEmail = Application.CreateItem(olMailItem)
With objNewEmail
.Subject = ""
.Body = ""
.To = "(e-mail address removed)"
.Send
End With
Set objNewMail = Nothing
End Sub
This works all very well in outlook as long as I run the macro everyday
manually.
What I was wanting help on was if its possible to do this in VBScript so I
can use MS scheduler to run this everyday at 8am, or is there a way in
Outlook 2003 to do this everyday?
If this was in VBScript, I could use MS scheduler and simply run it from
there?
Basically I want to be able to send 2 emails 1 minute apart at 8am everyday
automatically.
Any help is muchly appreciated.
each other:
Sub ServerTestingMacro()
'Macro Name will show as ServerTestingMacro
'Create 1st email to start escalation and send it
Set objNewEmail = Application.CreateItem(olMailItem)
With objNewEmail
.Subject = ""
.Body = ""
.To = "(e-mail address removed)"
.Send
End With
Set objNewMail = Nothing
'Wait a minute
lngTimeStart = Timer()
Do
'The DoEvents line prevents Outlook from locking up for the minute
DoEvents
lngTimeStop = Timer()
If (lngTimeStop - lngTimeStart) > 60 Then Exit Do
Loop
'Create 2nd email to acknowledge escalation and send it
Set objNewEmail = Application.CreateItem(olMailItem)
With objNewEmail
.Subject = ""
.Body = ""
.To = "(e-mail address removed)"
.Send
End With
Set objNewMail = Nothing
End Sub
This works all very well in outlook as long as I run the macro everyday
manually.
What I was wanting help on was if its possible to do this in VBScript so I
can use MS scheduler to run this everyday at 8am, or is there a way in
Outlook 2003 to do this everyday?
If this was in VBScript, I could use MS scheduler and simply run it from
there?
Basically I want to be able to send 2 emails 1 minute apart at 8am everyday
automatically.
Any help is muchly appreciated.