ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   macro help (https://www.excelbanter.com/excel-discussion-misc-queries/35351-macro-help.html)

tkaplan

macro help
 

I have the following macro written:

Sub SaveFile()

Dim newFileName As String
Dim curMonthName As String
Dim curYear As String
Dim curCenter As String
Dim curCounty As String

curMonthName = MonthName(month(Range("C4")))
curYear = Year(Range("C4"))
curCenter = Range("E1")
curCounty = Range("C1")

newFileName = curMonthName & " " & curYear & " " & curCounty & "
Billing CT" & curCenter

ActiveWorkbook.SaveAs Filename:= _
newFileName, FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False

End Sub

This saves the file with the name that I want it to save as. I would
like to add that the user chooses the location of where the file will
be saved. right now it's just saving to my documents, but i want the
user to be able to change that to where he/she wants.

how would i do this?

THank you.


--
tkaplan
------------------------------------------------------------------------
tkaplan's Profile: http://www.excelforum.com/member.php...o&userid=22987
View this thread: http://www.excelforum.com/showthread...hreadid=387266


Bob Umlas

Look at Application.GetSaveAsFileName

"tkaplan" wrote in
message ...

I have the following macro written:

Sub SaveFile()

Dim newFileName As String
Dim curMonthName As String
Dim curYear As String
Dim curCenter As String
Dim curCounty As String

curMonthName = MonthName(month(Range("C4")))
curYear = Year(Range("C4"))
curCenter = Range("E1")
curCounty = Range("C1")

newFileName = curMonthName & " " & curYear & " " & curCounty & "
Billing CT" & curCenter

ActiveWorkbook.SaveAs Filename:= _
newFileName, FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False

End Sub

This saves the file with the name that I want it to save as. I would
like to add that the user chooses the location of where the file will
be saved. right now it's just saving to my documents, but i want the
user to be able to change that to where he/she wants.

how would i do this?

THank you.


--
tkaplan
------------------------------------------------------------------------
tkaplan's Profile:

http://www.excelforum.com/member.php...o&userid=22987
View this thread: http://www.excelforum.com/showthread...hreadid=387266





All times are GMT +1. The time now is 06:35 AM.

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