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

And*_*193 6 powerpoint vba powerpoint-vba

VBA Powerpoint.我该如何设置环境当前目录?

我也试过这段代码:

Sub test()
Dim sPath As String
sPath = ActiveWorkbook.Path
MsgBox sPath
End Sub
Run Code Online (Sandbox Code Playgroud)

但是说: Object required

请帮我把它搞定......

bre*_*tdj 11

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

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
Run Code Online (Sandbox Code Playgroud)