Setting Control Textbox Text Range

B

Bill Foley

I can't seem to remember how to do this so I thought I would post in hopes
that someone else might know. I know how to set the text of a shape on a
particular slide. For example, to set a textbox on Slide 2 to be blank (no
text), I would use:

ActivePresentation.Slides(2).Shapes("TextBox1").TextFrame.TextRange.Text =
""

What I want to know is how do you clear out a textbox from the Control
Toolbox? I have an interactive slide where the instructor clicks in a
textbox control and types an "x" to mark that choice. Once the presentation
is completed I want to be able to clear the "x"'s out of all the text box
controls. I already know to use "ActivePresentation.Saved = True" to trick
PowerPoint into thinking it is already saved, but I want to know the syntax
above to set the value of a control textbox to blank. I seem to recall that
is has to do with OLEFormat, but I can't seem to get anything to work. Any
ideas?

TIA!
 
C

Chirag

Hi Bill,

The Shape.OLEFormat.Object gives you access to the ActiveX object. You can
access any property or method of the ActiveX object through it. For the
Textbox from Control Toolbox, you the following code to set the test to
"Hello":

---
ActivePresentation.Slides(1).Shapes("TextBox1").OLEFormat.Object.Text =
"Hello"
---

- Chirag

PowerShow - View multiple shows simultaneously
http://officeone.mvps.org/powershow/powershow.html
 
B

Bill Foley

PERFECT! Some times the easiest things escape me. Of course it would have
helped if my F1 would have worked when I tried to access this method in the
Object Browser. I still never saw this example just as it was written.
However, I WILL save this for future uses.

Thanks again, Chirag!
 

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