0

I am facing an issue with the custom textbox in a PowerPoint 2010 slide. I want to make the text that is initially there inside the textbox (say "Click to enter text") to disappear as soon as mouse is clicked on the textbox to enter some text. If this is possible through events in VBA, I would like to know which event(associated with the textbox) to capture and how to do it using VBA?

Also changing the height parameter is not having any effect in PowerPoint 2010.

here is my code that defines the textbox :

Dim sld As Slide

Set pShape = sld.Shapes.AddTextbox(msoTextOrientationHorizontal, Left:=50, Top:=50, width:=500, Height:=300)

pShape.TextFrame.TextRange = "Click to enter text"
pShape.TextFrame.TextRange.Font.Size = 14
pShape.Line.Visible = True
pShape.Line.ForeColor.RGB = RGB(0, 0, 0)
pShape.Line.DashStyle = msoLineDash

Plz help me out with this.. Thanks in advance!!!

1 Answer 1

0

The height is not taking because the default is to resize to fit availabl text.

Either use a shape not a textbox or reset the defaut

Set pShape = sld.Shapes.AddTextbox(msoTextOrientationHorizontal, Left:=50, Top:=50, Width:=500, Height:=300) pShape.TextFrame.AutoSize = ppAutoSizeNone pShape.Height = 300

Making the text disappear on click is possible but difficult. You can use the WindowSelectionChange event but this is very difficult to set up if you are not writing an addin. You would need to write a WithEvents Class module and initialise an instance. Fairly advanced!

Sign up to request clarification or add additional context in comments.

2 Comments

what you've suggested works fine. but what if i want both the functionality at a time, that is it should have a predefined height and still the textbox should grow or auto size itself as per the requirement?? also i want the user to be able to write something in the textbox by double clicking on it. but now what i see is as i mouse hover over the textbox, cursor does not appear
The text disappears using the WindowSelectionChange event but this happens only when I click anywhere on the textbox but not when I click on the text.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.