PowerPoint - Email Test Results
You've created a test or a training program in PowerPoint and you
would like the presentation to Email the results or maybe a completion
There's no inbuilt way to do this but if the PC has a full version of
Outlook then this function will do the job. As with all vba you need to be
sure that security allows the code to run. You can adapt the calling sub to
suit you needs, maybe adding a name or title.
Dim ret As Boolean
Dim strAddress As String
Dim strMessage As String
strAddress = "firstname.lastname@example.org"
strMessage = ActivePresentation.Slides(1).Shapes(3).TextFrame.TextRange '
change to suit
ret = SendEMail(strAddress, "From PowerPoint", strMessage)
MsgBox "Mail sent= " & ret
Public Function SendEMail(strRecipient As String, strSubject As String,
strBody As String) As Boolean
Dim oApp As Object
Dim oMail As Object
On Error Resume Next
Set oApp = GetObject(Class:="Outlook.Application")
If Err <> 0 Then Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(0)
.Subject = strSubject
.To = strRecipient
'copy to self
.CC = "email@example.com"
.BodyFormat = 1
.Body = strBody
Set oMail = Nothing
Set oApp = Nothing
If Err = 0 Then SendEMail = True Else SendEMail = False