Replicate text entered into a Control Text box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want user to enter a Username in a control text box, slide 2 to pick up
data entered. eg Slide 1 asks for user to enter username, slide 2 to pick up
that data input as "Hello 'username'."
I am using Office XP
 
This will require the use of VBA. Have you tried it in PowerPoint? The
process will require a few steps. First you need to assign names (or know
what the names are) of objects on slides. There is a macro below that you
can copy and paste into a Module in the VBE window that you can run after
selecting an object to give it a name that makes sense. Here is that code:

'=======Code Starts Here=======

Sub NameShape()
Dim Name$
On Error GoTo AbortNameShape

If ActiveWindow.Selection.ShapeRange.Count = 0 Then
MsgBox "No Shapes Selected"
Exit Sub
End If
Name$ = ActiveWindow.Selection.ShapeRange(1).Name

Name$ = InputBox$("Give this shape a name", "Shape Name", Name$)

If Name$ <> "" Then
ActiveWindow.Selection.ShapeRange(1).Name = Name$
End If
Exit Sub

AbortNameShape:
MsgBox Err.Description

End Sub

'========Code Stops Here=======

The next step is to put a control text box on your Slide 1 and look at the
Name property it has (TextBox1, for example). The next step is to assign a
name to a text box (or rectangle with no fill or line color) on Slide 2.
The last step is to have some code that assigns the text entered in the
control textbox to the textbox or rectangle on your slide. The problem with
this is that PowerPoint can't normally access the control textbox on a
slide. A variable must be assigned to it then that is accessed. For
simplicity, I normally use a UserForm to collect first name, last name,
etc., assign them to variables, then assign those variables to the text
range of an object on a slide.

I would be more than happy to send you a quick sample directly to you using
a UserForm if you wish. To get an idea of what I speak, I have a CBT sample
on this page that you can download and test out. Keep in mind that your
PowerPoint Macro Security MUST be set to something lower than HIGH
(preferably MEDIUM). You will be asked to "Enable Macros" and must click
"YES".

Let me know if you want me to send you a sample.
 
Thanks Bill
Have little experience with VBA - learning fast! Will give it a go and get
back to you. Many thanks for the quick response.
Dai
 
No problem Dive in, the water's cold (at least it is here this morning).
By the way, if you have an object on Slide 2 named "FirstName" (using the
code below) and want to assign the string variable "strFirstName" to it, the
code would be:

ActivePresentation.Slides(2).Shapes("FirstName").TextFrame.TextRange.Text =
strFirstName
 
In addition to what Bill said, you might want to check out the examples on my
site:

http://www.loyola.edu/education/PowerfulPowerPoint/

I don't use control textboxes for data entry in any of my examples; I use
InputBox for that . Other thatn that, my examples do just what you want.

You might also want to check out the Programming PowerPoint section of the
PPT FAQ:

http://www.pptfaq.com/

--David

David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
Hi Bill
Haven’t been able to get this working as yet, things will be on hold for a
couple of days and then will have another go. Many thanks
Dai
 
Hi David
Have accessed your web page and looked at the examples, as metioned to Bill
have not been able to get this working as yet, and things will be on hold for
a couple of days. Need to suss this out for a lessons I am producing. Many
thanks
Dai
 
Post the code you are using and we will try and sort it out. What is the
problem you have? Any error message boxes?
 
Hi Bill
Would be grateful for an example to try out. Have used a User Form with
Excel, but am not sure how the Userform is used in PP; does it replace the
first slide? I am trying to see if a short CBL unit I have produced in
Authorware can be done using PowerPoint.
 
Dai,

Send me a message to:

wfoley1 at txu dot com

and I will try and send a sample today. I have a class to teach later this
morning, but should be able to send you an example before the end of work
today.
 
Hi Bill
Thanks for the file and help.
Dai

Bill Foley said:
Dai,

Send me a message to:

wfoley1 at txu dot com

and I will try and send a sample today. I have a class to teach later this
morning, but should be able to send you an example before the end of work
today.

--
Bill Foley, Microsoft MVP (PowerPoint)
Microsoft Office Specialist Master Instructor - XP
www.pttinc.com
Check out PPT FAQs at: http://www.rdpslides.com/pptfaq/
 
Back
Top