Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vba PowerPoint:在每张幻灯片上重复文本_Vba_Powerpoint - Fatal编程技术网

Vba PowerPoint:在每张幻灯片上重复文本

Vba PowerPoint:在每张幻灯片上重复文本,vba,powerpoint,Vba,Powerpoint,我正在为日常课堂演示创建PowerPoint模板。在模板中,我希望在第一张幻灯片上突出显示大量文本,并在随后的幻灯片底部以较小的尺寸重复显示。文本每天都在变化 到目前为止,我的想法是: 使用文本字段。据我所知,PowerPoint没有任何类似文本字段的内容可以动态设置 使用页脚-这很有效,我可以修改母版以获得我想要的外观,但我真的希望从第一页获取文本值,以便自动应用编辑并保存设置页脚的初始步骤 使用VBA-我很愿意尝试一下,但我从未使用过VBA,学习曲线似乎很陡峭,因此如果知道这个想法在VBA

我正在为日常课堂演示创建PowerPoint模板。在模板中,我希望在第一张幻灯片上突出显示大量文本,并在随后的幻灯片底部以较小的尺寸重复显示。文本每天都在变化

到目前为止,我的想法是:

  • 使用文本字段。据我所知,PowerPoint没有任何类似文本字段的内容可以动态设置
  • 使用页脚-这很有效,我可以修改母版以获得我想要的外观,但我真的希望从第一页获取文本值,以便自动应用编辑并保存设置页脚的初始步骤
  • 使用VBA-我很愿意尝试一下,但我从未使用过VBA,学习曲线似乎很陡峭,因此如果知道这个想法在VBA中是否可行,那就太好了
这能做到吗?你会怎么做

下面是一个我希望能够做到的例子。理想情况下,该解决方案可以在Mac(2013)和Windows(2016)版本的PowerPoint上运行


您可以将演示文稿与excel文件连接起来。在ppt中运行该代码将从excel文件中提取文本并立即更新标题

使用带有一些临时文本的文本框创建演示文稿。将下面的代码放在ppt中。另存为pptm

Sub AddMotionPath()

    Dim Temp As String

Excel.Application.Workbooks.Open ("D:\Users\Desktop\Book1.xlsx") ' update the path of the excel file
Workbooks("Book1.xlsx").Activate 'activate the file

For p = 1 To 4
Temp = Workbooks("Book1.xlsx").Worksheets("Sheet1").Range("B" & p + 1).Value ' Column B has the titles
 ActivePresentation.Slides(p).Shapes(1).TextFrame.TextRange.Text = Temp ' this updates the titles from excel to ppt slide
Next
Excel.Application.Workbooks("Book1.xlsx").Close False 'closes the excel file

End Sub

让我知道这是否适合你。您可以更新excel文件并在ppt中运行宏。幻灯片中的文本将自动更新。

是否使用幻灯片母版?