![]() |
What am I missing here
The code below is suppose to check that cell C2 on the Projections Worksheet
is blank, Then runs the Calendar routine which places the selected date into cell C2 of the Projections Worksheet. This all works fine but the routine fails when it gets to the "ActiveWorkbook.SaveAs sFileName" line. I get an error msg saying "The File name or path does not exist" Any ideas? Private Sub CommandButton1_Click() Sheets("Projections").Select Range("C2").Select If ActiveCell 0 Then GoTo Done Calander.Show Dim sFileName As String, sTest As String sTest = Sheets("Projections").Range("C2").Text If IsDate(sTest) = False Then Exit Sub End If sFileName = "O:\PT_DRIVER_SCHED\Weekly Projections\" & _ Format(sTest, "yyyy\\MM-dd-yy") & " Projection" & ".xls" ActiveWorkbook.SaveAs sFileName Done: End Sub |
What am I missing here
It doesn't like the \\ in
-- HTH RP (remove nothere from the email address if mailing direct) "Patrick Simonds" wrote in message ... The code below is suppose to check that cell C2 on the Projections Worksheet is blank, Then runs the Calendar routine which places the selected date into cell C2 of the Projections Worksheet. This all works fine but the routine fails when it gets to the "ActiveWorkbook.SaveAs sFileName" line. I get an error msg saying "The File name or path does not exist" Any ideas? Private Sub CommandButton1_Click() Sheets("Projections").Select Range("C2").Select If ActiveCell 0 Then GoTo Done Calander.Show Dim sFileName As String, sTest As String sTest = Sheets("Projections").Range("C2").Text If IsDate(sTest) = False Then Exit Sub End If sFileName = "O:\PT_DRIVER_SCHED\Weekly Projections\" & _ Format(sTest, "yyyy\\MM-dd-yy") & " Projection" & ".xls" ActiveWorkbook.SaveAs sFileName Done: End Sub |
What am I missing here
TRy again.
It doesn't like the \\ in Format(sTest, "yyyy\\MM-dd-yy") Try Format(sTest, "yyyy MM-dd-yy") instead -- HTH RP (remove nothere from the email address if mailing direct) "Patrick Simonds" wrote in message ... The code below is suppose to check that cell C2 on the Projections Worksheet is blank, Then runs the Calendar routine which places the selected date into cell C2 of the Projections Worksheet. This all works fine but the routine fails when it gets to the "ActiveWorkbook.SaveAs sFileName" line. I get an error msg saying "The File name or path does not exist" Any ideas? Private Sub CommandButton1_Click() Sheets("Projections").Select Range("C2").Select If ActiveCell 0 Then GoTo Done Calander.Show Dim sFileName As String, sTest As String sTest = Sheets("Projections").Range("C2").Text If IsDate(sTest) = False Then Exit Sub End If sFileName = "O:\PT_DRIVER_SCHED\Weekly Projections\" & _ Format(sTest, "yyyy\\MM-dd-yy") & " Projection" & ".xls" ActiveWorkbook.SaveAs sFileName Done: End Sub |
All times are GMT +1. The time now is 04:05 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com