[RESOLVED] Excel "Save as" with path?
I am using this sub to save the active workbook:
Code:
Private Sub FileSave()
flFormat = ActiveWorkbook.FileFormat
flName = Range("D5").Value & ".xls"
flToSave = Application.GetSaveAsFilename(flName, filefilter:="Excel Files (*.xls), *.xls", _
Title:="Save FileAs...")
If flToSave = False Then
Exit Sub
Else
ThisWorkbook.SaveAs Filename:=flToSave, FileFormat:=flFormat
End If 'flToSave = False
End Sub 'FileSave()
but I can't figure out how to set the default directory to let's say "H:\Team A".
As there are lots of team members using the same template, I cant set up the name with the path included (e.g. Application.ActiveWorkbook.SaveAs "H:\Team A\John\Item.xls").
I found on the forums all kind of ideas, e.g. using ChDir, but none works.
Any suggestions will be appreciated.
Re: Excel "Save as" with path?
if flname ends in \ then the dialog will open the specified directory with no default file name
you can set the path as a variable and combine the path and file name, something like
Code:
mypath = "h:\team A\" & environ("username") &"\"
flToSave = Application.GetSaveAsFilename(mypath & flName, filefilter:="Excel Files (*.xls), *.xls", _
Title:="Save FileAs...")
Re: Excel "Save as" with path?
Works like a charm (I tried that before but for some reason it didn't work...). Thanks.