P
Patrick Simonds
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
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