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

angular - DownloadURL return null in below code -

meteor - inserting data to database gives error "insert failed: Method '/texts/insert' not found" -