I'm having problems sending outlook emails using Excel VBA. I have the code to do it - Sendupdate
- and it works fine when I manually run the macro. My second macro StartTimer
is intended to execute the above at a set time when I am not at my desk.
However, when the computer is locked the email does not send. When I come back to my desk the email is hanging there as a draft, and I need to click the send
button.
Here is my code:
Sub SendUpdate()
Recipient = "x@y.com"
Subj = "update"
Dim msg As String
msg = "hello”
HLink = "mailto:"& Recipient & "?"
HLink = HLink & "subject="& Subj & "&"
HLink = HLink & "body="& msg
ActiveWorkbook.FollowHyperlink (HLink)
Application.Wait (Now + TimeValue("0:00:01"))
Application.SendKeys "%s"
End Sub
Sub StartTimer()
Application.OnTime TimeValue("18:00:00"), "SendUpdate"
End Sub
Is there a way to code the macro to make sure the email gets pushed?