|
这是一个可以用VBA通过的将EXCEL数据更新到PPT,但我想将它转成VSTO代码,其中
objPrs = objPPT.presentations.Open(app.ThisWorkbook.Path & "\自动报表.pptx", , , msoFalse)
请问大家怎么解决
以下是VSTO代码
Private Sub Button102_Click(sender As Object, e As RibbonControlEventArgs) Handles Button102.Click
Dim app As Excel.Application = Globals.ThisAddIn.Application
Dim objPPT As Object
Dim objPrs As Object
Dim objChart As Object
Dim l As Object
Dim t As Object
Dim w As Object
Dim h As Object
app.Application.ScreenUpdating = False
objPPT = CreateObject("Powerpoint.application")
Dim msoFalse As Object = Nothing
objPrs = objPPT.presentations.Open(app.ThisWorkbook.Path & "\自动报表.pptx", , , msoFalse)
app.ThisWorkbook.Worksheets("明细").Pictures(app.ThisWorkbook.Worksheets("明细").Pictures.Count).Copy
With objPrs.Slides(1).Shapes(2)
l = .Left
t = .Top
w = .Width
h = .Height
.Delete
End With
objPrs.Slides(1).Shapes.Paste
With objPrs.Slides(1).Shapes(objPrs.Slides(1).Shapes.Count)
.LockAspectRatio = msoFalse
.Left = l
.Top = t
.Width = w
.Height = h
End With
objPrs.Save
objPrs.Close
objPPT.Quit
app.Application.ScreenUpdating = True
objPPT = Nothing
objPrs = Nothing
MsgBox("PPT报告数据更新完毕!")
End Sub
|
|