make VBA text box visible on button

  • Thread starter Thread starter easy
  • Start date Start date
E

easy

I use this bit of code to make an image visible

Sub Show()
ActivePresentation.Slides(15).Shapes(9).Visible = True
End Sub

Is there something similar you can do to make a text box (from the
control box) visible after its default visible property is false

Thanx in advance
 
I use this bit of code to make an image visible

Sub Show()
ActivePresentation.Slides(15).Shapes(9).Visible = True
End Sub

Is there something similar you can do to make a text box (from the
control box) visible after its default visible property is false

Same code works.

ActivePresentation.Slides(15).Shapes(xx).Visible = True
or
ActivePresentation.Slides(15).Shapes("ShapeName").Visible = True

Where xx is the shape's index, ShapeName is the name of the shape
 
I must be doing something wrong
I have tried this code which works when I run the code from the editor
and switch back to the presentation but it wont run when the
presntation is running
I have assigned Sub TxtBoxShow() to a action button on the slide but it
doesnt have any effect

Sub TxtBoxHide()
Dim otxtBox As TextBox
Set otxtBox = ActivePresentation.Slides(1).Shapes(1).OLEFormat.Object
With otxtBox
..Visible = msoFalse

End With

End Sub

Sub TxtBoxShow()

Dim otxtBox As TextBox
Set otxtBox = ActivePresentation.Slides(1).Shapes(1).OLEFormat.Object
With otxtBox
..Text = "Text Box is now visible"
..Visible = msoTrue

End With


End Sub
 
I must be doing something wrong

Your first approach should work:

ActivePresentation.Slides(1).Shapes(1).Visible = True

It does here; you haven't said what happens when you run it, so lets's back up
to that point and try it again.

Is the the TextBox in fact Shape #1 on that slide?

What error messages do you get when the code runs, if any?
What happens when you step through the code a line at a time?
 
Hi Steve
It is probably best to describe what I am trying to achieve with this
code.
I am trying to create a "Virtual Flipchart" where the presenter can
type a list or notes on screen rather than using a traditional
flipchart/pen, but also give the presenter the option to show the
textbox as and when required. The text box should also be empty of any
previous text entered.

The text box I have posted is identified as TextBox1 using Shyam
Pillais shape identifier add in
I dont get any error messages when i run the code from either the VBA
editor or powerpoint.
If I run the code from the VBA editor, any changes in the code have
taken place when I switch back to PowerPoint, but if I assign the code
to an action button on the slide it has no affect.

In summary what I want to happen is
A button on an index (Slide 1) initialises the text box on slide 2 by
making it invisble and removing all text
A button on slide 2 to display the text box and allow the user to enter
text on screen
A 2nd button on Slide 2 would be nice to export the text to a text file
or a word document to record what has been input. Much like the meeting
minder facility but more controllable in terms of appearance and page
specific.

Hope that makes sense

Ian
 
Hi Steve
It is probably best to describe what I am trying to achieve with this
code.
I am trying to create a "Virtual Flipchart" where the presenter can
type a list or notes on screen rather than using a traditional
flipchart/pen, but also give the presenter the option to show the
textbox as and when required. The text box should also be empty of any
previous text entered.

The text box I have posted is identified as TextBox1 using Shyam
Pillais shape identifier add in
I dont get any error messages when i run the code from either the VBA
editor or powerpoint.
If I run the code from the VBA editor, any changes in the code have
taken place when I switch back to PowerPoint, but if I assign the code
to an action button on the slide it has no affect.

In summary what I want to happen is
A button on an index (Slide 1) initialises the text box on slide 2 by
making it invisble and removing all text

' use this
With SlideShowWindows(1).Presentation.Slides(2).Shapes("TextBox1")
.OLEFormat.Object.Text = ""
.Visible = False
End With

One thing, though ... I'm noticing that this is bug-ridden.
It works (up to a point) in 2003 but not in 2000. Hello?
A button on slide 2 to display the text box and allow the user to enter
text on screen

SlideShowWindows(1).Presentation.Slides(2).Shapes("TextBox1").Visible = True

And in fact if the shape's invisible, it'll make it visible and enabled for
editing. But if you've run the previous macro first, the shape becomes visible
but you can't enter any text.

Has anyone mentioned before now that controls on slides are evil?
A 2nd button on Slide 2 would be nice to export the text to a text file
or a word document to record what has been input. Much like the meeting
minder facility but more controllable in terms of appearance and page
specific.

This will give you the text in the object:

SlideShowWindows(1).Presentation.Slides(2).Shapes("TextBox1").Oleformat.Object.
Text
 
Thanx Steve
Any ideas for an alternative method of creating a virtual flipchart?

First, let's see if anybody pops in to tell me that I'm an idiot and all I
needed to have you do was XXX to make it work perfectly. Because I'm convinced
that it SHOULD work.

If not, how about a VBA form with a text box that appears when the user clicks
a button and has a Close button to make it go 'way.
 
Steve
I had the same thought and I have attached the text box to a form and
it works great, it even clears itself when it is re launched
I have even manged to get it to print the form using:

UserFrom.print,

Which unsurprisingly prints the form along with the print button.
Can I get the print button just to print the contents of the text box?
What is the command to close the form from a button?
What about saving the contents of the text box ?

Even though I know nothing about it I love this VBA and the potential
it gives me. I need to get some training somewhere.
 
Steve
I had the same thought and I have attached the text box to a form and
it works great, it even clears itself when it is re launched
I have even manged to get it to print the form using:

UserFrom.print,

Which unsurprisingly prints the form along with the print button.
Can I get the print button just to print the contents of the text box?

Hmmm. What about saving to file then launching the file in Notepad and
printing from there?
What is the command to close the form from a button?

' to make the form disappear
Me.Hide
' then either from within the same module in the form or
' in the module that called the form
Unload Formname ' where Formname is the name you've given the form
What about saving the contents of the text box ?

Have a look here:
Export the notes text of a presentation
http://www.rdpslides.com/pptfaq/FAQ00481.htm

But lose all the code that collects notes text and instead of saving
strNotesText to file, use Me.txtYourTextBoxName.Text
Even though I know nothing about it I love this VBA and the potential
it gives me. I need to get some training somewhere.

It's a real grin when it falls into place, isn't it?

There are lots of good books out there; don't worry if they're for VB rather
than VBA; the fundamentals are pretty much the same.
 
Back
Top