ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Userform (https://www.excelbanter.com/excel-programming/306525-userform.html)

Robin Clay[_3_]

Userform
 
Greetings !

Tom suggests I need a userform.

My code at the moment includes :

---------------------------
Do
CutOffDate = InputBox("Enter the cut-off date " & _
"and time you want," & vbCrLf & _
"i.e. copy only files more recent" & _
vbCrLf & _
"in the format dd/mm/yyyy hh:mm:ss", _
"Get Cut-off Date & Time", _
"04/08/2004 07:30:00")
If Len(CutOffDate) < 19 _
Or Mid(CutOffDate, 3, 1) < "/" _
Or Mid(CutOffDate, 6, 1) < "/" _
Or Mid(CutOffDate, 11, 1) < " " _
Or Mid(CutOffDate, 14, 1) < ":" _
Or Mid(CutOffDate, 17, 1) < ":" Then
'We don't have a valid entry
OK = False
Else
OK = True
End If
Loop While Not OK
---------------------------

I was going to use :

---------------------------
Dim IWantNewer as Boolean

IWantNewer = InputBox("Enter Y if you want " & _
"newer files, " & vbCrLf & _
"or N if not", _
"Newer files ?", _
"N")
---------------------------

but Tom suggests a userform. How do I code that ?

IWantNewer = UserForm(....???)


Help !


RClay AT haswell DOT com

Tom Ogilvy

Userform
 
You said you had 4 inputboxes that received boolean values. I **asked**

You want to replace your four input boxes with a userform with 4

optionbuttons?


Your first example of getting a date has nothing to do with boolean values.
If you are only going to get one response, then you should probably use a
msgbox. Then the user only has to click, not type in a value.

Dim IWantNewer as Boolean
IWantNewer = InputBox("Do you want " & _
"newer files, " , vbYesNo) = vbYes

--
Regards,
Tom Ogilvy







"Robin Clay" wrote in message
...
Greetings !

Tom suggests I need a userform.

My code at the moment includes :

---------------------------
Do
CutOffDate = InputBox("Enter the cut-off date " & _
"and time you want," & vbCrLf & _
"i.e. copy only files more recent" & _
vbCrLf & _
"in the format dd/mm/yyyy hh:mm:ss", _
"Get Cut-off Date & Time", _
"04/08/2004 07:30:00")
If Len(CutOffDate) < 19 _
Or Mid(CutOffDate, 3, 1) < "/" _
Or Mid(CutOffDate, 6, 1) < "/" _
Or Mid(CutOffDate, 11, 1) < " " _
Or Mid(CutOffDate, 14, 1) < ":" _
Or Mid(CutOffDate, 17, 1) < ":" Then
'We don't have a valid entry
OK = False
Else
OK = True
End If
Loop While Not OK
---------------------------

I was going to use :

---------------------------
Dim IWantNewer as Boolean

IWantNewer = InputBox("Enter Y if you want " & _
"newer files, " & vbCrLf & _
"or N if not", _
"Newer files ?", _
"N")
---------------------------

but Tom suggests a userform. How do I code that ?

IWantNewer = UserForm(....???)


Help !


RClay AT haswell DOT com




Tom Ogilvy

Userform
 
Whoops,
didn't finish altering your code:

Dim IWantNewer as Boolean
IWantNewer = MsgBox("Do you want " & _
"newer files, " , vbYesNo) = vbYes

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
You said you had 4 inputboxes that received boolean values. I **asked**

You want to replace your four input boxes with a userform with 4

optionbuttons?


Your first example of getting a date has nothing to do with boolean

values.
If you are only going to get one response, then you should probably use a
msgbox. Then the user only has to click, not type in a value.

Dim IWantNewer as Boolean
IWantNewer = InputBox("Do you want " & _
"newer files, " , vbYesNo) = vbYes

--
Regards,
Tom Ogilvy







"Robin Clay" wrote in message
...
Greetings !

Tom suggests I need a userform.

My code at the moment includes :

---------------------------
Do
CutOffDate = InputBox("Enter the cut-off date " & _
"and time you want," & vbCrLf & _
"i.e. copy only files more recent" & _
vbCrLf & _
"in the format dd/mm/yyyy hh:mm:ss", _
"Get Cut-off Date & Time", _
"04/08/2004 07:30:00")
If Len(CutOffDate) < 19 _
Or Mid(CutOffDate, 3, 1) < "/" _
Or Mid(CutOffDate, 6, 1) < "/" _
Or Mid(CutOffDate, 11, 1) < " " _
Or Mid(CutOffDate, 14, 1) < ":" _
Or Mid(CutOffDate, 17, 1) < ":" Then
'We don't have a valid entry
OK = False
Else
OK = True
End If
Loop While Not OK
---------------------------

I was going to use :

---------------------------
Dim IWantNewer as Boolean

IWantNewer = InputBox("Enter Y if you want " & _
"newer files, " & vbCrLf & _
"or N if not", _
"Newer files ?", _
"N")
---------------------------

but Tom suggests a userform. How do I code that ?

IWantNewer = UserForm(....???)


Help !


RClay AT haswell DOT com






Robin Clay[_3_]

Userform
 

-----Original Reply from Tom Ogilvy-----
You said you had 4 inputboxes that received
boolean values. I **asked**
You want to replace your four input boxes with a
userform with 4 optionbuttons?


"Userforms" are "terra incognita" to me, alas....
and I would prefer to avoid yet another learning curve....

Your first example of getting a date has nothing
to do with boolean values.


Erm... yes, sorry - I guess that was a bit of a red
herring - but indicated my current "thought process"

If you are only going to get one response,
then you should probably use a msgbox.
Then the user only has to click, not type in a value.


Ah. Thank you.

Dim IWantNewer as Boolean
IWantNewer = InputBox("Do you want " & _
"newer files, " , vbYesNo) = vbYes


Looks just the job.

I have four such Boolean questions, and thought that four
buttons on screen at once might be easier for the user
than four consecutive MsgBoxes.

But I guess you're right.

Yet again ! <grin


Thank you very much. Again !


RClay AT haswell DOT com



All times are GMT +1. The time now is 05:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com