Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Save to a certain location
I'm having difficulties saving a file to a certain location.
My code is. Sub closeappandsave() Application.ScreenUpdating = False servpath = "c:\my documents" Period = Workbooks("Flash Report V1.0.xls").Worksheets("Summary").Range("AA1").Text Week = Workbooks("Flash Report V1.0.xls").Worksheets("Summary").Range("AA2").Text File = Workbooks("Flash Report V1.0.xls").Worksheets("Summary").Range("z6").Value ThisWorkbook.SaveAs Filename:="servpath & " \ " & Period & " \ " & Week & " \ " & File" End Sub Any help on getting this working would be appreciated. Nick |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Save to a certain location
Variables should not have double quotes..
ThisWorkbook.SaveAs Filename:= servpath & "\" & Period & "\" & Week & "\" & File -- If this post helps click Yes --------------- Jacob Skaria "N1KO" wrote: I'm having difficulties saving a file to a certain location. My code is. Sub closeappandsave() Application.ScreenUpdating = False servpath = "c:\my documents" Period = Workbooks("Flash Report V1.0.xls").Worksheets("Summary").Range("AA1").Text Week = Workbooks("Flash Report V1.0.xls").Worksheets("Summary").Range("AA2").Text File = Workbooks("Flash Report V1.0.xls").Worksheets("Summary").Range("z6").Value ThisWorkbook.SaveAs Filename:="servpath & " \ " & Period & " \ " & Week & " \ " & File" End Sub Any help on getting this working would be appreciated. Nick |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Save to a certain location
Legend, been looking at it for hours now.
Thanks "Jacob Skaria" wrote: Variables should not have double quotes.. ThisWorkbook.SaveAs Filename:= servpath & "\" & Period & "\" & Week & "\" & File -- If this post helps click Yes --------------- Jacob Skaria "N1KO" wrote: I'm having difficulties saving a file to a certain location. My code is. Sub closeappandsave() Application.ScreenUpdating = False servpath = "c:\my documents" Period = Workbooks("Flash Report V1.0.xls").Worksheets("Summary").Range("AA1").Text Week = Workbooks("Flash Report V1.0.xls").Worksheets("Summary").Range("AA2").Text File = Workbooks("Flash Report V1.0.xls").Worksheets("Summary").Range("z6").Value ThisWorkbook.SaveAs Filename:="servpath & " \ " & Period & " \ " & Week & " \ " & File" End Sub Any help on getting this working would be appreciated. Nick |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Save to a certain location
Dear NIKO
Forgot to mention slash should be represented as "\" and not " \ " (with spaces).. Few more suggestions 1. Use Option Explicit 2. Declare variables 3. Use prefix for variables to reflect the type (str for String) Option Explicit Sub closeappandsave() Dim strServerPath As String Dim strPeriod As String Dim strWeek As String Dim strFile As String Application.ScreenUpdating = False strServerPath = "c:\my documents" strPeriod = Workbooks("Flash Report V1.0.xls").Worksheets("Summary").Range("AA1").Text strWeek = Workbooks("Flash Report V1.0.xls").Worksheets("Summary").Range("AA2").Text strFile = Workbooks("Flash Report V1.0.xls").Worksheets("Summary").Range("z6").Value ThisWorkbook.SaveAs Filename:= strServerPath & "\" & strPeriod & "\" & strWeek & "\" & strFile End Sub -- If this post helps click Yes --------------- Jacob Skaria "N1KO" wrote: Legend, been looking at it for hours now. Thanks "Jacob Skaria" wrote: Variables should not have double quotes.. ThisWorkbook.SaveAs Filename:= servpath & "\" & Period & "\" & Week & "\" & File -- If this post helps click Yes --------------- Jacob Skaria "N1KO" wrote: I'm having difficulties saving a file to a certain location. My code is. Sub closeappandsave() Application.ScreenUpdating = False servpath = "c:\my documents" Period = Workbooks("Flash Report V1.0.xls").Worksheets("Summary").Range("AA1").Text Week = Workbooks("Flash Report V1.0.xls").Worksheets("Summary").Range("AA2").Text File = Workbooks("Flash Report V1.0.xls").Worksheets("Summary").Range("z6").Value ThisWorkbook.SaveAs Filename:="servpath & " \ " & Period & " \ " & Week & " \ " & File" End Sub Any help on getting this working would be appreciated. Nick |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro - save to current location vs excel default location | Excel Discussion (Misc queries) | |||
how to save the same file in other location | Excel Discussion (Misc queries) | |||
default save location on network | Excel Discussion (Misc queries) | |||
SAVE IN LOCATION | Excel Worksheet Functions | |||
Save to specific location | Excel Discussion (Misc queries) |