vba - 在 powerpoint 中编辑嵌入对象

标签 vba excel powerpoint

我有一个 Powerpoint 演示文稿,其中一张幻灯片中嵌入了 Excel 工作簿。我还有一个用户表单,我希望用户在其中输入信息,我想获取此信息,然后使用相关信息编辑 Excel 工作表。

我不知道如何在 powerpoint 中访问 Excel 工作表,因此我可以更改单元格的值。

最佳答案

Sub a()

Dim oSl As PowerPoint.Slide
Dim oSh As PowerPoint.Shape

Set oSl = ActivePresentation.Slides(1)

Set oSh = oSl.Shapes(1)

With oSh.OLEFormat.Object.Sheets(1)
    .Range("A1").Value = .Range("A1").Value + 1
    .Range("A2").Value = .Range("A2").Value - 1
End With

Set oSl = Nothing
Set oSh = Nothing

End Sub  

灵感来自 this code

关于vba - 在 powerpoint 中编辑嵌入对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4528053/

相关文章:

python - 通过python将PPT转PNG

vba - 无法使用 VBA 粘贴到合并单元格中

excel - 在不破坏使用 Range.Value 的 vba 宏的情况下在 excel 中添加新行

第二次保存为 CSV 文件时 Excel 崩溃

excel - 当查找失败时 Range.Find 会产生错误

c# - 如何使用 C# 和 OpenXML 在 PowerPoint 演示文稿中调整大小和图像

vba - 在 PowerPoint 中选择一系列幻灯片

vba - 在 VBA 中处理过滤集

VBA 如何 : Prompt When ActiveInspector. 当前项目在 Outlook 中为空?

vba - 根据 ID 列匹配来自两个工作簿的数据并更新 ID 匹配的第一个工作簿的两列中的数据