this is what I hope is correct
Private Sub Workbook_Open()
With Me
If .Worksheets("nofrillsbetfair").Range("D13").Value <> Date Then
If Time > TimeSerial(11, 0, 0) And Time <= TimeSerial(12, 30, 0) Then
Application.Run "Sheet2.CommandButton21_Click"
Else
Application.OnTime TimeSerial(11, 0, 0), "Btw.xlsm!Sheet2.CommandButton21_Click"
End If
With .Worksheets("nofrillsbetfair")
.Unprotect "daveGood"
.Range("d13") = Date
.Protect "daveGood"
End With
.SaveAs Filename:=Left$(.Name, InStrRev(.Name, ".") - 1) & Format(Date, "yyyymmdd") & .Worksheets("Races").Range("AB40").Value
End If
End With
End Sub
Set entervalues_sh = Sheets("enter values")
lrow = entervalues_sh.Cells(Rows.Count, "w").End(xlUp).Row
If lrow = 1 Then Exit Sub
data = entervalues_sh.Range("w1:w" & lrow)
For i = 2 To lrow
If data(i, 1) <> "" Then
temp = Trim(data(i, 1))
If Len(temp) = 2 Then
itime = TimeSerial(temp, 0, 0)
ElseIf Len(temp) <> 5 Then
arr = Split(temp, ".")
itime = TimeSerial(arr(0), arr(1) * 10, 0)
Else
arr = Split(temp, ".")
itime = TimeSerial(arr(0), arr(1), 0)
End If
Application.OnTime DateAdd("n", -IIf(Sheets("nofrillsbetfair").Range("f13") = 0, 4, Sheets("nofrillsbetfair").Range("f13")), itime), "Btw.xlsm!Sheet2.CommandButton22_Click"
End If
Next
End Sub
this is the bit I was unsure about
End If
End With
End Sub
and got the error here on the .name part of the formula
.SaveAs Filename:=Left$(.Name