In Ms office PPT20 13, click the graphic button to display the corresponding content with VBA, or click other graphic buttons to switch the content?

In Microsoft office PowerPoint 2013, you can use VBA(Visual Basic for Applications) to write code, and realize the function of clicking the graphic button to display the corresponding content and switch the content. The following is sample code that demonstrates how to implement this function:

First, open PowerPoint 20 13 and press ALT+F 1 1 to open the VBA editor. In the project browser window on the left, double-click "ThisPresentation" to open the code window of the presentation.

In the Code window, enter the following code:

Option explicit

Private Subshape _Click ()

Label the clicked shape as a shape.

Set clickedShape = ActiveWindow。 Selection.ShapeRange( 1)

According to the name or other attributes of the clicked graphic button, the corresponding operation is performed.

Select the case and click the shape. name

The first button of the case "button1"

Add code to display the corresponding content here.

MsgBox "Click the button 1"

The second button of the case "Button 2"

Add code to display the corresponding content here.

MsgBox "Click Button 2"

Add more button processing logic

End selection

End joint

In the code, we use the Shape_Click event handler to capture the event of clicking the graphic button. In the event handler, we first get the clicked graphic button, and then use the Select Case statement to perform the corresponding operation according to the name or other attributes of the button. You can modify the conditions and operations of the Select Case statement according to the actual situation to realize the functions you need.

Please note that you need to replace "Button 1" and "Button2" in the code with the name or other properties of the graphic button you actually use.

After writing the code, save and close the VBA editor. Then, insert graphic buttons in PowerPoint and set corresponding names or other properties for each button to identify it in the code.

When you click the graphic button in the presentation, the corresponding code will be executed and the corresponding content will be displayed according to the name or other properties of the button.

I hope this example can help you realize your needs. If you have any other questions, please feel free to ask.