View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default 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