VBA代码实现:PPT中使两个文本框内容链接,自动同步

2025-03-13 22:37:57
推荐回答(1个)
回答1:

下面代码是把第二张幻灯片的标题设置为第一张幻灯片的文件框的内容
ActivePresentation.Slides(2).Shapes(1).TextFrame.TextRange.Text = ActivePresentation.Slides(1).Shapes(3).TextFrame.TextRange.Text
下面代码是显示第一张幻灯片中所有文本框的内容,你看着哪个对你有用,用哪个吧
Private Sub CommandButton1_Click()
Dim i As Integer
With ActivePresentation.Slides(1)
For i = 1 To .Shapes.Count
If .Shapes(i).Type = msoTextBox Then
MsgBox .Shapes(i).TextFrame.TextRange.Text
End If
Next
End With
End Sub