ExcelBanter

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

N1KO

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



Jacob Skaria

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



N1KO

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



Jacob Skaria

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




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

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