VBA Powerpoint。如何在VBA中获取文件的当前目录路径?

时间:2012-09-22 17:39:27

标签: vba powerpoint powerpoint-vba

VBA Powerpoint。如何设置环境当前目录?

我也试过这段代码:

Sub test()
Dim sPath As String
sPath = ActiveWorkbook.Path
MsgBox sPath
End Sub

但是说:Object required

请帮助我让它发挥作用......

1 个答案:

答案 0 :(得分:10)

蒂姆提供了答案。你可以使用类似的东西:

Sub test()
    Dim sPath As String
    sPath = ActivePresentation.Path
    If Len(sPath) > 0 Then
        MsgBox ActivePresentation.Name & vbNewLine & "saved under" & vbNewLine & sPath
    Else
        MsgBox "File not saved"
    End If
End Sub