Email textboxes on current slide

L

lmac

I have four txtbxs on a slide that I wish to email as the body of the
email message when the user/viewer clicks the Email Results button in
slide show view.

4 txtbxs are:
Your Name (this is named txtbxName)
Your 6 digit ID (this is named txtbxID)
Test Start Time (this is named StartTime)
Test End Time (this is named EndTime)

I want the button/hyperlink to email the info collected on the current
slide with:
mailto: [email protected]
Subject: Online Testing Completed
&body = the 4 txtbxs mentioned above

Is it possible to select these txtbxs and make them the email body
message?
 
B

Bill Foley

Sure, if you use VBA, name your objects on your slides, then code those into
the variables in the subject/body of your message. Keep in mind that some
of this depends on which e-mail program you use (and sometimes on the
version). Does everyone have the same version of Outlook? If so, which
one?

Here is a sample of some code I use. Keep in mind that I have assigned
variables to the contents of certain textboxes, etc. and have that info
referenced as variables in the body/subject/etc. There are other lines of
code used that assigns text of a textbox to a variable. You will need to
play with this to get exactly what you want.

=====Code starts here=====

Sub EmailIt()
Dim objOutlook As Object 'Outlook.Application
Dim objOutlookMsg As Object 'Outlook.MailItem
Dim objOutlookRecip As Object 'Outlook.Recipient
Dim objOutlookAttach As Object 'Outlook.Attachment

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(0) 'olMailItem=0

With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add([email protected])
objOutlookRecip.Type = 1 'olTo = 1

' Set the Subject, Body, and Importance of the message.
.Subject = "Your Typed Subject Here" ' or a variable
.Body = "I have reviewed the presentation. I scored " & Score * 100 & _
"% on the quiz." & Chr(10) & "First name: " & firstname & Chr(10) &
_
"Last name: " & lastname & Chr(10) & "SSN: " & SocialSecurityNumber
& Chr(10) & _
"My feedback is:" & strFeedback
.Save
.Send
End With
Set objOutlook = Nothing
End Sub

=====Code Ends Here=====

I have a sample download to get an idea of what you can do with PowerPoint
regarding using it as CBT at the link below. However this version does not
use the e-mail sending capabilities or the Access database updating
capabilities. It is merely a sample to give you ideas. If you need
specific help developing something like this for your organization, please
feel free to contact me directly.

http://www.pttinc.com/cbt_development.html
 
L

lmac

Thanks for the reply and the sample code. Actually, everyone is using
Lotus Notes 6.5. Just having trouble trying to get macro or code to
pull data from these textboxes and send in email. Will continue
searching for solution. thanks
 
B

Bill Foley

Lotus Notes, hey?? Here is some sample code that you can try out. Not sure
of version specific problems:

=====Code Starts here=====

Sub MailData()


Dim Session As Object, DB As Object, Memo As Object
Dim Server$, Mailfile$
Dim Item As Object, strSubject As String, strBody As String

' These are my variables I use for my materials
strSubject = "Put Your Subject Here, or use variables"

Set Session = CreateObject("Notes.NotesSession")

' Read the current mail server from Notes.ini
Server$ = Session.GETENVIRONMENTSTRING("MailServer", True)

' Read the current mail file from Notes.ini
Mailfile$ = Session.GETENVIRONMENTSTRING("MailFile", True)

' Try to open the mail database
Set DB = Session.GETDATABASE(Server$, Mailfile$)

' If Mail db not accessible, return an error
If Not DB.IsOpen Then
MsgBox "Could not access Notes mail file! Please call Your Name at Your
Extension to receive credit."
Exit Sub
End If

'LN Message
'Create a memo in the user's mail file
Set Memo = DB.CREATEDOCUMENT

'Set the form to be a mail memo
Memo.Form = "Memo"
Memo.copyto = "wherever"

'Set the "from" field (not necessary)
Memo.From = Session.UserName

'Set the recipient of the memo (you will change this for your needs)!
Memo.SendTo = "[email protected]"

'Give the memo a subject
Memo.Subject = strSubject

' Give the memo a body message
' These are some of the variables I use
Memo.Body = "I have reviewed the presentation. I scored " & Format(Score,
"00.0%") & _
" on the quiz." & Chr(10) & "First name: " & strfirstname & Chr(10) & _
"Last name: " & strlastname & Chr(10) & "SSN: " & strSSN & Chr(10) &
Chr(10) & _
"Items in this training that were most useful to me or aided my
learning: " & Chr(10) & strFeedback1 & Chr(10) & Chr(10) & _
"Items in this training that were least useful to me or interfered with
my learning: " & Chr(10) & strFeedback2 & Chr(10) & Chr(10) & _
"Recommendations to improve this training: " & Chr(10) & strFeedback3 &
Chr(10) & Chr(10) & _
"Did the training help improve existing skills or provide information to
enhance personal/professional growth? " & Chr(10) & strFeedback4 & Chr(10) &
Chr(10) & _
"Database Status:" & strDatabaseStatus

'Send the memo
Call Memo.SEND(False, False)

' Restore NOTES variables back to nothing
Set DB = Nothing
Set Session = Nothing


End Sub

=====Code Stops Here=====
 
L

lmac

In the Memo.Body where you are using strfirstname, strlastname,
strFeedback1 are these referring to named textboxes on the slide where
the user inputted this information in a form?
 
L

lmac

Ok, here is what I'm using:

Memo.Body = "I have completed the Online Training." & Chr(10) &
"Your Name: " & strtxtbxName & Chr(10) & _
"Your 6 digit ID: " & strtxtbxID & Chr(10) & "Test Start Time: " &
strStartTime & Chr(10) & "Test End Time: " & strEndTime

but when I click the command button it does create the email message
but the fields are blank like this or it puts a zero in them:

I have completed the Online Training.
Your Name: 0
Your 6 digit ID: 0
Test Start Time: 0
Test End Time: 0
 
B

Bill Foley

There is a lot more to it than that. You must name your textboxes so they
are easy to manipulate. Yu must then declare a variable and set it equal to
the textbox. My question to you is how are you putting information into
those textboxes? Are they types in during edit mode or are you using the
textbox control from the Control Toolbox?

Here is a link to a FAQ page on my site that explains how to use a UserForm
to capture information (strFirstName, strLastName, strSSN, etc. Maybe it
will shed some light on your question.

http://www.pttinc.com/ppt_faq7.html

If you want to learn how to reference an ActiveX control on your slide,
check out Shyam's page at:

http://skp.mvps.org/ppt00042.htm
 
L

lmac

Two of the textboxes are filled in when the user fills out a popup
form, that's the name & ID#. The time textboxes are filled in when the
user clicks Start or End buttons that automatically put the current
date&time in the textbox. I have named my textboxes. In the email
code, do I need to use Dim As String like this:

Dim strtxtbxName As String
Dim strtxtbxID As String
Dim strStartTime As String
Dim strEndTime As String

and put this in the Memo.Body section?

ActivePresentation.Slides(2).Shapes("txtbxName").TextFrame.TextRange.Text
= strtxtbxName
ActivePresentation.Slides(2).Shapes("txtbxID").TextFrame.TextRange.Text
= strtxtbxID
ActivePresentation.Slides(2).Shapes("StartTime").TextFrame.TextRange.Text
= strStartTime
ActivePresentation.Slides(2).Shapes("EndTime").TextFrame.TextRange.Text
= strEndTime
 
L

lmac

Thanks for your replies. I was able to get the code to work. I forgot
to Dim As String my named textboxes and refer to them as variables as
you stated. It is working fine now. Thanks.
 
Top