在命令按钮上单击从Sharepoint打开一个ppt-VBA

时间:2019-02-22 15:53:06

标签: excel vba

我想使用命令按钮通过VBA打开SharePoint的ppt表单

如果有人知道,请帮助我。

谢谢...

我在下面有类似的代码..但是它给了我错误

Dim PPT As PowerPoint.Application
Dim fileName As Variant
Dim WS1 As Worksheet
Dim rng As Range
Set WS1 = ThisWorkbook.Worksheets("Sheet4")
Set rng = WS1.Range("AA4")


Set PPT = New PowerPoint.Application
fileName = rng

PPT.Visible = True

'PPT.Presentations.Open fileName:="F:\Reports\" & Business_Plan.Value & ".ppt"
PPT.Presentations.Open fileName("AA4")

1 个答案:

答案 0 :(得分:0)

假设工作表1中的“ A2”值为整个路径+文件名(F:\ Reports \ FileName.ppt)

Sub openPowerP()
    Dim PPT As PowerPoint.Application
    Dim fileName As String
    Dim WS1 As Worksheet
    Set WS1 = ThisWorkbook.Sheets("Sheet1")
    fileName = WS1.Range("A2").Value
    Set PPT = New PowerPoint.Application
    PPT.Presentations.Open fileName
End Sub

当然需要引用powerpoint。 PowerPoint Reference