VBA:PowerPoints演示文稿以只读方式打开

时间:2013-12-20 13:35:27

标签: vba powerpoint powerpoint-vba

我尝试打开,更改并保存演示文稿,但它始终以只读方式打开:

If measTypesDict.Exists(MeasType) = False Then
    Dim targetPath As String
    Dim newPres As PowerPoint.presentation

    measTypesDict.Add MeasType, New Dictionary

    Set newPres = PowerPoint.Application.Presentations.Add(msoFalse)

    targetPath = rootDir & "\final\" & MeasType & ".ppt"
    newPres.SaveAs targetPath
    ' newPres.Close that is what's been missing

    targetPresentationsDict.Add MeasType, Presentations.Open(targetPath, ReadOnly:=msoFalse, WithWindow:=msoFalse)
End If

来自Microsoft Documentation

The ReadOnly parameter is used to open a presentation as Read-Only. 
The following example opens a file named test.ppt as Read-Only.

   Sub OpenPresentationReadOnly()
      Presentations.Open "c:\test.ppt", msoTrue
   End Sub

任何人都可以给我一个提示,为什么会这样?我是目标文件夹的所有者,我根据文件夹设置完全控制。

1 个答案:

答案 0 :(得分:-1)

你可以试试这个:

   Sub OpenPresentation()
      Presentations.Open "c:\test.ppt"
   End Sub

希望它有所帮助。