【发布时间】:2015-07-24 16:57:47
【问题描述】:
我正在使用以下代码保存文件,但我无法获取保存的文件路径和名称。
有没有办法获取这些详细信息?
Sub Test3()
On Error Resume Next
Dim FileSelected As String
Dim strPath As String
FileSelected = Application.Dialogs(xlDialogSaveAs).Show
If Not FileSelected <> "False" Then
MsgBox "You have cancelled"
Exit Sub
End If
If FileSelected <> "False" Then
strPath = Application.FileDialog(msoFileDialogSaveAs).SelectedItems(1)
'displays the result in a message box
Call MsgBox(strPath, vbInformation, "Save Path")
Exit Sub
End If
End Sub
【问题讨论】: