W
Wi11y13
I need to send a pre-populated e-mail utilizing whatever application is
default on the users machine. This is in VBA from a PowerPoint slideshow. I
am able to actually create the e-mail and it comes up on the screen but I
need to have it automatically sent such that the user never actually sees it
and does not need to be involved in the sending action.
I have created (with lots of internet help) the following code (please
excuse as I am sure it is not very professional - but it at least does create
the email):
Sub SendMyEMail()
Dim emaddr As String
Dim subj As String
Dim Name As String
Dim salutation As String
Dim hlink As Variant
emaddr = "(e-mail address removed)"
subj = "Training Completion for "
ID = Environ("USERNAME")
salutation = "Completed"
'compose default parts of the message
hlink = "mailto:" & emaddr & "?"
hlink = hlink & "subject=" & subj & ID & "&"
hlink = hlink & "body=" & ID & " has completed the Training "
ActivePresentation.FollowHyperlink hlink
DoEvents
keybd_event VK_MENU, 0, 0, 0 ' set Alt
keybd_event vbKeyD, 0, 0, 0 ' set D key down
keybd_event vbKeyD, 0, KEYEVENTF_KEYUP, 0 ' set D key up
keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0 ' set left win key up
End Sub
As you can see I have attempted to use the ALT-D key sequence but no luck. I
believe it is probably because the CPU is actually in the email application
and does not see the ALT-D until I exit from that application and come back
to Powerpoint.
Does anyone know how I can invoke this FollowHyperlink to automatically send
this email?
Thanks for the help
default on the users machine. This is in VBA from a PowerPoint slideshow. I
am able to actually create the e-mail and it comes up on the screen but I
need to have it automatically sent such that the user never actually sees it
and does not need to be involved in the sending action.
I have created (with lots of internet help) the following code (please
excuse as I am sure it is not very professional - but it at least does create
the email):
Sub SendMyEMail()
Dim emaddr As String
Dim subj As String
Dim Name As String
Dim salutation As String
Dim hlink As Variant
emaddr = "(e-mail address removed)"
subj = "Training Completion for "
ID = Environ("USERNAME")
salutation = "Completed"
'compose default parts of the message
hlink = "mailto:" & emaddr & "?"
hlink = hlink & "subject=" & subj & ID & "&"
hlink = hlink & "body=" & ID & " has completed the Training "
ActivePresentation.FollowHyperlink hlink
DoEvents
keybd_event VK_MENU, 0, 0, 0 ' set Alt
keybd_event vbKeyD, 0, 0, 0 ' set D key down
keybd_event vbKeyD, 0, KEYEVENTF_KEYUP, 0 ' set D key up
keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0 ' set left win key up
End Sub
As you can see I have attempted to use the ALT-D key sequence but no luck. I
believe it is probably because the CPU is actually in the email application
and does not see the ALT-D until I exit from that application and come back
to Powerpoint.
Does anyone know how I can invoke this FollowHyperlink to automatically send
this email?
Thanks for the help