Save a worksheet with form Save As location in Exc

2019-08-31 00:05发布

Well, I am not a developer but an regular an Excel user try to automate some process while working so please understand if my question is of simple to do.

I just want to a macro that can when I run the macro, it will allow me to Browse the computer so I can save the file in the direction and file name I like If possible Default location is the location of the workbook, just to save time

Thank you

1条回答
等我变得足够好
2楼-- · 2019-08-31 00:52

Try below code :

Sub SaveAsDailog()

Application.DisplayAlerts = False
Dim filePath As Variant
filePath = Application.GetSaveAsFilename("abcd.xlsx", "Excel Files (*.xlsx), *.xlsx")

If VarType(filePath) = vbString Then
 ActiveWorkbook.SaveAs Filename:=filePath
End If


Application.DisplayAlerts = True
End Sub
查看更多
登录 后发表回答