I am using the following code to save the file but i am not able to get the saved file path and name .
Is there a way to get those details?
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
Try using Application.GetSaveAsFilename
. Create a Variant
variable, and set that to Application.GetSaveAsFilename
after you save it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.