Share via

PowerPoint button help

Anonymous
2018-08-01T18:27:04+00:00

I have a 2 activex text boxes and I have used a button on a separate slide to clear one of the textboxes. The coding on the button is as follows: 

Private Sub CommandButton1_Click()

' make sure the name TextBox1 is correct!

With ActivePresentation.Slides(1).Shapes("TextBox1").OLEFormat.Object

.Text = ""

End With

End Sub

this coding clears the activex text box named "textbox1". is there anyway I can make this button also clear the other text box at the same time? I'm guessing it would be just a small variation in the coding to clear both instead of the one. Thanks so much.

Microsoft 365 and Office | PowerPoint | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

8 answers

Sort by: Most helpful
  1. John Korchok 232.8K Reputation points Volunteer Moderator
    2018-08-02T13:29:28+00:00

    I'm sure there is, but you would have to answer the question in my last post. What does "resetting the presentation" mean? What tasks must be accomplished to do this? You haven't explained this, so I can't answer it.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2018-08-02T00:11:04+00:00

    I want to have the button clear the 2 textboxes and as well reset the presentation. It's for a course on PowerPoint and I don't want the students being able to leave presentation mode. So I want the end presentation button to clear my 2 textboxes and reset the presentation for the next student. So is there coding that I can add to do all 3?

    Was this answer helpful?

    0 comments No comments
  3. John Korchok 232.8K Reputation points Volunteer Moderator
    2018-08-01T23:37:33+00:00

    With the 2 text fields, you deleted the content. What constitutes a reset of the slide? What has to be done?

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2018-08-01T22:54:55+00:00

    it works, thank you so much. Is there a possible variation I can add to the code that will also allow the button to reset to the first slide of the presentation? So it would have 3 functions: Rest both textboxes, and reset to the first slide. That would be amazing if you could help me with this. thanks soo much.

    Was this answer helpful?

    0 comments No comments
  5. John Korchok 232.8K Reputation points Volunteer Moderator
    2018-08-01T19:20:45+00:00

    Yes, it would look like this:

    Private Sub CommandButton1_Click()

      With ActivePresentation.Slides(1)

        .Shapes("TextBox1").OLEFormat.Object.Text = ""

        .Shapes("SecondTextBoxName").OLEFormat.Object.Text = ""

      End With

    End Sub

    BTW, you only need to use With/End With when there is more than one operation on the same object, in this case ActivePresentation.Slides(1).

    Was this answer helpful?

    0 comments No comments