Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello, I have a form that has six buttons on it. I have another form that I would like to capture the button that was pressed. For instance if Bt1 is pressed I am hiding current form, opening a different form and putting 1 in a text box. Any help would be appreciated.
|
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hello,
http://www.cjoint.com/c/FHcwDJybXga ' "Module 1" '_________________________________________________ ___________ Sub OpenForm() UserForm1.Show End Sub '_________________________________________________ ___________ ' "Classe 1" '_________________________________________________ ___________ Public WithEvents cmdButton As MSForms.commandbutton Dim cmdButtonName As String Private Sub cmdButton_Click() cmdButtonName = Me.cmdButton.Caption UserForm2.TextBox1 = cmdButtonName UserForm2.Show End Sub '_________________________________________________ ___________ ' "UserForm1" '_________________________________________________ ___________ Dim x() As New Classe1 Private Sub UserForm_Initialize() Dim a As Integer For Each c In Me.Controls If TypeName(c) = "CommandButton" Then a = a + 1 ReDim Preserve x(1 To a) Set x(a).cmdButton = c End If Next End Sub '_________________________________________________ ___________ isabelle Le 2016-08-02 * 13:23, jlclyde a écrit : Hello, I have a form that has six buttons on it. I have another form that I would like to capture the button that was pressed. For instance if Bt1 is pressed I am hiding current form, opening a different form and putting 1 in a text box. Any help would be appreciated. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hello,
I modify the code to adapt it to your demand http://www.cjoint.com/c/FHdhwtXOX6a ' "Module 1" '_________________________________________________ ___________ Sub OpenForm() UserForm1.Show End Sub '_________________________________________________ ___________ ' "Classe 1" '_________________________________________________ ___________ Public WithEvents cmdButton As MSForms.commandbutton Dim cmdButtonName As String Private Sub cmdButton_Click() cmdButtonName = Me.cmdButton.Caption n = Right(cmdButtonName, 1) UF1.TextBox1 = n UserForm1.Hide UF1.Show End Sub '_________________________________________________ ___________ ' "UserForm1" '_________________________________________________ ___________ Dim x() As New Classe1 Private Sub UserForm_Initialize() Dim a As Integer For Each c In Me.Controls If TypeName(c) = "CommandButton" Then If CDbl(Right(c.Name, 1)) = 1 And CDbl(Right(c.Name, 1)) <= 6 Then a = a + 1 ReDim Preserve x(1 To a) Set x(a).cmdButton = c End If End If Next End Sub Private Sub CommandButton7_Click() End End Sub Private Sub UserForm_Terminate() End End Sub '_________________________________________________ ___________ isabelle |
#4
![]() |
|||
|
|||
![]()
_________@@@@@@@@_____ _____@@@@@@____________ ___@@@@@@______________ __@@@@@@@_____________ ___@@@@@@______________ _____@@@@@@____________ _________@@@@@@@@_____ ___________________________ ______@@@@@@@@@_______ __@@@@@_______@@@@@__ _@@@@@_________@@@@@_ _@@@@@_________@@@@@_ _@@@@@_________@@@@@_ __@@@@@_______@@@@@__ ______@@@@@@@@@_______ ___________________________ ______@@@@@@@@@_______ __@@@@@_______@@@@@__ _@@@@@_________@@@@@_ _@@@@@_________@@@@@_ _@@@@@_________@@@@@_ __@@@@@_______@@@@@__ ______@@@@@@@@@_______ ________________________ __@@@@@@________________ __@@@@@@________________ __@@@@@@________________ __@@@@@@________________ __@@@@@@________________ __@@@@@@@@@@@@@@___ __@@@@@@@@@@@@@@___ __@@@@@@@@@@@@@@___.
|
#5
![]() |
|||
|
|||
![]()
_________@@@@@@@@_____ _____@@@@@@____________ ___@@@@@@______________ __@@@@@@@_____________ ___@@@@@@______________ _____@@@@@@____________ _________@@@@@@@@_____ ___________________________ ______@@@@@@@@@_______ __@@@@@_______@@@@@__ _@@@@@_________@@@@@_ _@@@@@_________@@@@@_ _@@@@@_________@@@@@_ __@@@@@_______@@@@@__ ______@@@@@@@@@_______ ___________________________ ______@@@@@@@@@_______ __@@@@@_______@@@@@__ _@@@@@_________@@@@@_ _@@@@@_________@@@@@_ _@@@@@_________@@@@@_ __@@@@@_______@@@@@__ ______@@@@@@@@@_______ ________________________ __@@@@@@________________ __@@@@@@________________ __@@@@@@________________ __@@@@@@________________ __@@@@@@________________ __@@@@@@@@@@@@@@___ __@@@@@@@@@@@@@@___ __@@@@@@@@@@@@@@___.
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Close user form when button is pressed | Excel Programming | |||
preventing button being pressed | Excel Discussion (Misc queries) | |||
Can't select macro button after other button is pressed | Excel Programming | |||
Which button was pressed? | Excel Programming | |||
Errormessage when button is pressed twice or more | Excel Programming |