gpt4 book ai didi

Excel VBA 更新 PowerPoint 文本框

转载 作者:行者123 更新时间:2023-12-04 21:55:53 25 4
gpt4 key购买 nike

在以下编码的帮助下,我可以打开 powerpoint 文件,但它没有更新文本框。

我收到“对象变量或未设置 block 变量”的错误。

Dim PPT As PowerPoint.Application
Dim pres As PowerPoint.Presentation
Dim newslide As PowerPoint.Slide
Dim slideCtr As Integer
Dim tb As PowerPoint.Shape

Set PPT = CreateObject("PowerPoint.Application")
PPT.Visible = True
Set pres = PPT.Presentations.Open( _
"C:\Users\GShaikh\Desktop\Process Coach certificate template.pptx")
slideCtr = 1
Set tb = newslide.Shapes("TextBox1")
tb.TextFrame2.TextRange.Characters.Text = "OK"

最佳答案

尝试:

    PPT.ActivePresentation.Slides(2).Shapes("TextBox1").TextFrame.TextRange.Characters.Text = "qwerty"

要获得正确的形状名称(在输入框中以便您可以复制它),请选择它并运行:
a = InputBox("The name of the selected shape is:", "Name of the Shape", PPT.ActiveWindow.Selection.ShapeRange.Name)

要更改它,请在选择它时尝试:
PPT.ActiveWindow.Selection.ShapeRange.Name = "TextBox2"

希望这可以帮助。

关于Excel VBA 更新 PowerPoint 文本框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45056880/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com