Log in

View Full Version : how do I change text in textbox using VBA



dinkybluebug
11-11-2008, 11:02 AM
Hi...

I know this is going to be a really dumb question to answer, but I am trying to learn a little visual basic, and I am getting myself tied up in all sorts of knots.

I am trying to add a rectangle shape to a slide in powerpoint.. The shape will have a large zero in it.... of which when the user clicks on this zero, it changes to 1.

then when you click on it again it moves to 2, and then 3, and so on.

I have tried to work this out myself, but can;t work it out.

any help would really be appreciated.


Please help.....

many thanks

Marc

Demosthine
11-11-2008, 03:30 PM
Good Morning.

Welcome to the Forum. It's always good to have new members. Just in case you didn't realize, from the main VBA Express Forum page, you can select a variety of sub-Forums that relate specifically to a particular Application. In order to get the best answer possible, please post your questions to the appropriate Forum.

That being said, for your specific question, you will need to use a Macro Action. Inside the Procedure, you'll want to access the particular TextBox using:

Ensure Macros are enabled in PowerPoint.
Press Alt+F11 to open the Visual Basic Environment.
Right-click the Project Explorer and Insert Module.
Create a new Public Sub.
Close the Visual Basic Environment.
Insert your TextBox.
Right-click the TextBox and select Custom Action.
Set it to Run Macro.


ActivePresentation.Slides(n).Shapes(n).TextFrame.TextRange.Text = n


Hope this helps.
Scott