ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   get path - save new file - same sub-directory as existing file (https://www.excelbanter.com/excel-programming/280120-get-path-save-new-file-same-sub-directory-existing-file.html)

tegger

get path - save new file - same sub-directory as existing file
 
Is it possible to amend this code to get the path so as to save the new file
in the same sub-directory as the existing file?

Worksheets(1).Select
ActiveWorkbook.SaveAs Filename:=Format(Range("H22").Value, "d MMMM yyyy") &
" NEW.xls" _


--

DL



Alan Howells

get path - save new file - same sub-directory as existing file
 
Worksheets(?).Path

Alan

"tegger" wrote in message
...
Is it possible to amend this code to get the path so as to save the new

file
in the same sub-directory as the existing file?

Worksheets(1).Select
ActiveWorkbook.SaveAs Filename:=Format(Range("H22").Value, "d MMMM yyyy")

&
" NEW.xls" _


--

DL





Chip Pearson

get path - save new file - same sub-directory as existing file
 
Try something like

ActiveWorkbook.SaveAs Filename:=ActiveWorkbook.Path & _
"\" & Format(Range("H22").Value,"d MMMM yyyy) & " New.xls"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"tegger" wrote in message
...
Is it possible to amend this code to get the path so as to save the new

file
in the same sub-directory as the existing file?

Worksheets(1).Select
ActiveWorkbook.SaveAs Filename:=Format(Range("H22").Value, "d MMMM yyyy")

&
" NEW.xls" _


--

DL






All times are GMT +1. The time now is 08:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com