Change Directory, Save As

dantb

Active Member
Joined
Mar 20, 2002
Messages
358
Hello all: The below saves one sheet in a workbook and gives it the name of what ever is in cell (A1). The problem I have is I need to save it to a sub directory under c:\A Temp, which are many, is there a way to have the Save as box come up starting at (c:\A Temp Folder) where I can pick a sub directory and then it will save as cell (A1)’s value?

Sub Save23()
Application.ScreenUpdating = False
ActiveSheet.Select
ActiveSheet.Copy
ThisFile = Range("A1").Value
ChDir "C:\"
ActiveSheet.SaveAs Filename:="C:\A Temp\" & ThisFile & ".xls"
ActiveWorkbook.Close
Application.ScreenUpdating = True
End Sub
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hope this will help:

Sub Save23()
Dim strFile As String
Application.ScreenUpdating = False
ActiveSheet.Select
ActiveSheet.Copy
Thisfile = Range("A1").Value
ChDir "C:\A Temp"
strFile = Application.GetSaveAsFilename(Thisfile, "Excel File (*.xls),*.xls")
ActiveSheet.SaveAs Filename:=strFile & ".xls"
ActiveWorkbook.Close
Application.ScreenUpdating = True
End Sub

Regards,
Yeheya
 
Upvote 0

Forum statistics

Threads
1,211,965
Messages
6,105,120
Members
447,947
Latest member
OX_2005

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top