Printing a TextBox using VBA?

N

Nikki

How do I print the content entered in a TextBox from slide 34 on a separate
slide? Please see the following code:

Sub PrintablePage()
Dim printableSlide As Slide

Set printableSlide = ActivePresentation.Slides.Add(Index:=86, _
Layout:=ppLayoutText)
printableSlide.Shapes(1).TextFrame.TextRange.Text = _
userName & " Description of Incident"

?????'printableSlide. CONTENT OF ON SLIDE 34 goes here???????

Set homeButton = ActivePresentation.Slides(86).Shapes.AddShape _
(msoShapeActionButtonCustom, 0, 0, 150, 50)
homeButton.TextFrame.TextRange.Text = "Another Scenario"
homeButton.ActionSettings(ppMouseClick).Action = ppActionRunMacro
homeButton.ActionSettings(ppMouseClick).Run = "Another Scenario"
Set printButton = ActivePresentation.Slides(86).Shapes.AddShape _
(msoShapeActionButtonCustom, 200, 0, 150, 50)
printButton.TextFrame.TextRange.Text = "Print Results"
printButton.ActionSettings(ppMouseClick).Action = ppActionRunMacro
printButton.ActionSettings(ppMouseClick).Run = "PrintResults"
ActivePresentation.SlideShowWindow.View.Next
ActivePresentation.Saved = True
End Sub
 
D

David M. Marcovitz

Nikki,

If I understand you correctly, you want to take some text from a shape on
slide 34 and put it in the newly created printableSlide to print out. If you
want the text from shape 2 to go onto the printable slide, then you could do
something like the following:

printableSlide.Shapes(2).TextFrame.TextRange.Text = _
ActivePresentation.Slides(34).Shapes(2).TextFrame.TextRange.Text

If the text is in a different shape on slide 34, then change the second 2 to
a different number or to the name of the shape (in quotes).

--David

David Marcovitz
Microsoft PowerPoint MVP
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
N

Nikki

Dr. Marcovitz...

The textbox on slide 34 is an "Active TextBox" (rather than a shape)
inserted from the "Control Toolbox". When I insert the following, it shows a
blank text frame. Any suggestions?

Thank you...
 
N

Nikki

More info...

I inserted a "TextBox" (on slide 34) from the Control Toolbar so that the
user can enter a brief paragraph during the slideshow. Id like to print the
paragraph the user wrote on the printable slide.

Thanks again-Nikki
 
D

David M. Marcovitz

Nikki,

I'm sorry I won't be able to help you for a few days. I am not in my office
this week, and at home I only have PowerPoint 98 on a Mac, and the control
toolboxes don't work on a Mac. What you want to do is possible and, I
believe, relatively easy, but I don't know the answer off the top of my head.
If you don't get a response here soon, ask your question again in a new
thread. You can probably add the text to a public string variable as you
type and then replace the right side of the equal sign (in the code below)
with that variable. I know there are a dozen people in this group that can
help you, but you might need a new thread because they might have missed this
thread thinking your question was already answered.
--David

David Marcovitz
Microsoft PowerPoint MVP
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
D

David M. Marcovitz

In case you missed it, here is my answer that I posted as a response to
another thread:

Nikki,

I'm back although not with very much time. I think I have the answer. In
your regular module (probably named Module 1), declare your report
variable:

Public Report as String

In your slide 34 module (created when you drew the control toolbox and
double-clicked on it):

Private Sub TextBox1_Change()
Report = TextBox1.Text
End Sub

Then your code in the PrintablePage procedure (back in your main module)
should work fine:

printableSlide.Shapes(2).TextFrame.TextRange.Text = _
Report

I'm pretty sure that this should work for you just like you want. I knew
it would be easy (it took me more time to type this response than to
figure out the answer). Let us know if you have any more questions.

--David

David Marcovitz
Microsoft PowerPoint MVP
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top