excel - how to get dynamic location for Application.GetSaveAsFilename VBA? -


i have code below save workbook file writerespassword, there way current workbook's path in interface application.getsaveasfilename? saving interface displays document folder, requires 5-10 more clicks wanted.

    sub passwordsave()        application.displayalerts = false        application.screenupdating = false        saveasname = application.getsaveasfilename(filefilter:="excel files (*.xlsx), *.xlsx")        activeworkbook.saveas filename:=saveasname, fileformat:= xlnormal, writerespassword:="test", readonlyrecommended:=false, createbackup:=false     end sub 

the dialog's starting directory whatever curdir says is, can use chdir before calling dialog:

chdir activeworkbook.path 

or

chdir "c:\users\public\desktop" 

Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -