Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
The following code is very simple. All I need to do is figure out how get the
result of the userform entry from the click event. I apologize if seems to easy but I have trouble with userforms and menus getting user data. Thanks for Your Help Sub test() UserForm1.show If Me.OptionButton1 = "True" Then Debug.Print "Option One has been Selected" Else Debug.Print "This has failed miserably" End If End Sub Private Sub OptionButton1_Click() Dim Sel As String Unload Me MsgBox ("You Select Buton 1") Sel = Me.OptionButton1 End Sub Private Sub OptionButton2_Click() Unload Me MsgBox ("You Select Buton 2") Unload Me End Sub Private Sub OptionButton3_Click() MsgBox ("You Select Buton 3") Unload Me End Sub |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Walter,
Are you trying to use a bit of code to show a form and then test what control was invoked, from within the original code? If so, I think you have a problem, as control will not pass back to that code (the IF statement) until the form is closed, either hidden or unloaded,. What exactly is the purpose of what you are trying to do. -- HTH RP (remove nothere from the email address if mailing direct) "Walter L. skinner" wrote in message ... The following code is very simple. All I need to do is figure out how get the result of the userform entry from the click event. I apologize if seems to easy but I have trouble with userforms and menus getting user data. Thanks for Your Help Sub test() UserForm1.show If Me.OptionButton1 = "True" Then Debug.Print "Option One has been Selected" Else Debug.Print "This has failed miserably" End If End Sub Private Sub OptionButton1_Click() Dim Sel As String Unload Me MsgBox ("You Select Buton 1") Sel = Me.OptionButton1 End Sub Private Sub OptionButton2_Click() Unload Me MsgBox ("You Select Buton 2") Unload Me End Sub Private Sub OptionButton3_Click() MsgBox ("You Select Buton 3") Unload Me End Sub |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Bob: I have VB code that formats and defines a print area. What I need is an
input from the user telling me which header to use for the printout. I was looking to use a list of buttons, wanting the user to select only one of them. Then I would use that information to select the header in my code. I thought I could envoke a user form displaying the choices and then on a "click" event get the user data and transfer it from the private sub "Click" to my code. I think that explains what I want to do. If that is the wrong approach, I would appreciate a good one. Thanks W. Skinner "Bob Phillips" wrote: Walter, Are you trying to use a bit of code to show a form and then test what control was invoked, from within the original code? If so, I think you have a problem, as control will not pass back to that code (the IF statement) until the form is closed, either hidden or unloaded,. What exactly is the purpose of what you are trying to do. -- HTH RP (remove nothere from the email address if mailing direct) "Walter L. skinner" wrote in message ... The following code is very simple. All I need to do is figure out how get the result of the userform entry from the click event. I apologize if seems to easy but I have trouble with userforms and menus getting user data. Thanks for Your Help Sub test() UserForm1.show If Me.OptionButton1 = "True" Then Debug.Print "Option One has been Selected" Else Debug.Print "This has failed miserably" End If End Sub Private Sub OptionButton1_Click() Dim Sel As String Unload Me MsgBox ("You Select Buton 1") Sel = Me.OptionButton1 End Sub Private Sub OptionButton2_Click() Unload Me MsgBox ("You Select Buton 2") Unload Me End Sub Private Sub OptionButton3_Click() MsgBox ("You Select Buton 3") Unload Me End Sub |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Why not just a print button to the userform, and then add the code that you
already have in Test to that button's Click event, without the show? Private Sub CommandButton1_Click() If Me.OptionButton1 Then 'set print header 1 ElseIf Me.OptionButton2 Then 'set print header 2 Else Debug.Print "This has failed miserably" End If End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Walter L. skinner" wrote in message ... Bob: I have VB code that formats and defines a print area. What I need is an input from the user telling me which header to use for the printout. I was looking to use a list of buttons, wanting the user to select only one of them. Then I would use that information to select the header in my code. I thought I could envoke a user form displaying the choices and then on a "click" event get the user data and transfer it from the private sub "Click" to my code. I think that explains what I want to do. If that is the wrong approach, I would appreciate a good one. Thanks W. Skinner "Bob Phillips" wrote: Walter, Are you trying to use a bit of code to show a form and then test what control was invoked, from within the original code? If so, I think you have a problem, as control will not pass back to that code (the IF statement) until the form is closed, either hidden or unloaded,. What exactly is the purpose of what you are trying to do. -- HTH RP (remove nothere from the email address if mailing direct) "Walter L. skinner" wrote in message ... The following code is very simple. All I need to do is figure out how get the result of the userform entry from the click event. I apologize if seems to easy but I have trouble with userforms and menus getting user data. Thanks for Your Help Sub test() UserForm1.show If Me.OptionButton1 = "True" Then Debug.Print "Option One has been Selected" Else Debug.Print "This has failed miserably" End If End Sub Private Sub OptionButton1_Click() Dim Sel As String Unload Me MsgBox ("You Select Buton 1") Sel = Me.OptionButton1 End Sub Private Sub OptionButton2_Click() Unload Me MsgBox ("You Select Buton 2") Unload Me End Sub Private Sub OptionButton3_Click() MsgBox ("You Select Buton 3") Unload Me End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|