B
bigjim
I am using Excel 2003 and I want to save a file to a different folders based
on the contents of a cell.
If I use this code it saves the file in the folder c:\field tickets
just as it is supposed to:
Dim strappend As String
Dim strpath As String
Dim str3 As String
strappend = ActiveSheet.Range("j8")
strpath = "c:\field tickets\"
str3 = ActiveSheet.Range("c8")
fsavename = strpath & strappend & str3 & ".xls"
If Dir(fsavename) <> "" Then
fsavename = strpath & strappend & str3 & "a.xls"
End If
ActiveWorkbook.Sheets("Devon ASC f").SaveAs fsavename
ActiveWorkbook.Close False
Now, if I use this code, it saves it to My Documents and not to the folder
c:\field tickets. What am I doing wrong?
Cell j627 contains C:\Field Tickets\
Dim strappend As String
Dim strpath As String
Dim str3 As String
strappend = ActiveSheet.Range("j8")
strpath = ActiveSheet.Range("j627")
str3 = ActiveSheet.Range("c8")
fsavename = strpath & strappend & str3 & ".xls"
If Dir(fsavename) <> "" Then
fsavename = strpath & strappend & str3 & "a.xls"
End If
ActiveWorkbook.Sheets("Devon ASC f").SaveAs fsavename
ActiveWorkbook.Close False
on the contents of a cell.
If I use this code it saves the file in the folder c:\field tickets
just as it is supposed to:
Dim strappend As String
Dim strpath As String
Dim str3 As String
strappend = ActiveSheet.Range("j8")
strpath = "c:\field tickets\"
str3 = ActiveSheet.Range("c8")
fsavename = strpath & strappend & str3 & ".xls"
If Dir(fsavename) <> "" Then
fsavename = strpath & strappend & str3 & "a.xls"
End If
ActiveWorkbook.Sheets("Devon ASC f").SaveAs fsavename
ActiveWorkbook.Close False
Now, if I use this code, it saves it to My Documents and not to the folder
c:\field tickets. What am I doing wrong?
Cell j627 contains C:\Field Tickets\
Dim strappend As String
Dim strpath As String
Dim str3 As String
strappend = ActiveSheet.Range("j8")
strpath = ActiveSheet.Range("j627")
str3 = ActiveSheet.Range("c8")
fsavename = strpath & strappend & str3 & ".xls"
If Dir(fsavename) <> "" Then
fsavename = strpath & strappend & str3 & "a.xls"
End If
ActiveWorkbook.Sheets("Devon ASC f").SaveAs fsavename
ActiveWorkbook.Close False