ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Save to specific location (https://www.excelbanter.com/excel-discussion-misc-queries/42062-save-specific-location.html)

LB79

Save to specific location
 

Hello - Im having trouble with a save macro... When a user presses the
button i want the file to save itself to a a specific location. The
below is my caode which works apart from it saves to H:\ATMT instead
of G:\2005\ATMT. Can anyone see where im going wrong?

Thanks

Private Sub CommandButton6_Click()
Sheets("Report").Copy
v2 = Sheets("Report").Range("C10").Value
v3 = Sheets("Report").Range("N10").Value
ChDir "G:\2005\ATMT"
ActiveWorkbook.SaveAs Filename:= _
v2 & " " & v3, FileFormat:=xlNormal
End Sub


--
LB79
------------------------------------------------------------------------
LB79's Profile: http://www.excelforum.com/member.php...o&userid=12156
View this thread: http://www.excelforum.com/showthread...hreadid=398632


FSt1

hi,
add the file path to the save.
i assume v2 and v3 are cells and it's being saved as an xl file.

ActiveWorkbook.SaveAs Filename:= _
"G:\2005\ATMT\" & v2 & "_" & v3 & ".xls", FileFormat:=xlNormal _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False

Regards
FSt1
"LB79" wrote:


Hello - Im having trouble with a save macro... When a user presses the
button i want the file to save itself to a a specific location. The
below is my caode which works apart from it saves to H:\ATMT instead
of G:\2005\ATMT. Can anyone see where im going wrong?

Thanks

Private Sub CommandButton6_Click()
Sheets("Report").Copy
v2 = Sheets("Report").Range("C10").Value
v3 = Sheets("Report").Range("N10").Value
ChDir "G:\2005\ATMT"
ActiveWorkbook.SaveAs Filename:= _
v2 & " " & v3, FileFormat:=xlNormal
End Sub


--
LB79
------------------------------------------------------------------------
LB79's Profile: http://www.excelforum.com/member.php...o&userid=12156
View this thread: http://www.excelforum.com/showthread...hreadid=398632



LB79


Fantastic - thats great - thanks!


--
LB79
------------------------------------------------------------------------
LB79's Profile: http://www.excelforum.com/member.php...o&userid=12156
View this thread: http://www.excelforum.com/showthread...hreadid=398632



All times are GMT +1. The time now is 08:48 PM.

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