Consulting

Results 1 to 2 of 2

Thread: how do I change text in textbox using VBA

  1. #1

    how do I change text in textbox using VBA

    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

  2. #2
    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.

    [VBA]
    ActivePresentation.Slides(n).Shapes(n).TextFrame.TextRange.Text = n
    [/VBA]

    Hope this helps.
    Scott
    You don't understand anything until you learn it more than one way. ~Marvin Minsky

    I never teach my pupils; I only attempt to provide the conditions in which they can learn. - Albert Einstein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •