What am I missing here

  • Thread starter Patrick Simonds
  • Start date
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
 
B

Bob Phillips

It doesn't like the \\ in


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
B

Bob Phillips

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top