Doug, (Bob)
Sorry for the lack of info in the original post, it was late and I was
trying to keep it short and sweet !
Anyway what I'm trying to do is use the values in 2 text boxes on the
userform as part of 2 time variants in some code which auto saves a copy of a
workbook at an interval specified by the user and then stops after a peroid
aslo spaecified by the user. Currently these values are enter in 2 cells on
the worksheet.
The working code is :-
Public RunWhen As Double
Public RunFor As Double
Public cSavePeriodMins As Double
Public cRunIntervalSeconds As Double
Public Const cRunWhat = "The_SubSave"
Public Const cHowLong = "The_SubPeriod"
Sub StartTimer()
cRunIntervalSeconds = UserForms("DDE Sheet").Range("I2").Value
RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
Application.OnTime earliesttime:=RunWhen, _
procedure:=cRunWhat, schedule:=True
End Sub
Sub StartPeriod()
cSavePeriodMins = Worksheets("DDE Sheet").Range("K2").Value
RunFor = Now + TimeSerial(0, cSavePeriodMins, 0)
Application.OnTime earliesttime:=RunFor, _
procedure:=cHowLong, schedule:=True
End Sub
I've tried :-
cRunIntervalSeconds = UserForms("frnOptions").Range("TextBox1").Value
cSavePeriodMins = UserForms("frnOptions").Range("TextBox2").Value
But this returns a type mismatch
Now I've looked at this again and at a reasonable hour I think this may be
due to the format of the text box needing to be a number and is by default
formated as text but at present I don't know how to change this.
Mark