Try below code, and hope this is what u want.
On Form1, u have more than two, but let's say there's 2 buttons
On Form2, u need 3 textboxes for Caption, Tag, and toolTipText, and one Apply button. However, u can't edit name of button.Code:Option Explicit Private pvarButton As CommandButton Property Get GetButton() As CommandButton Set GetButton = pvarButton End Property Private Sub Command2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then Set pvarButton = Command2 Form2.Show vbModal End If End Sub Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then Set pvarButton = Command1 Form2.Show vbModal End If End Sub
JoonCode:Option Explicit Private pvarButton As CommandButton Private Sub Command1_Click() pvarButton.Caption = txtName pvarButton.Tag = txtTag pvarButton.ToolTipText = txtToolTip Set pvarButton = Nothing Unload Me End Sub Private Sub Form_Load() Set pvarButton = Form1.GetButton End Sub




Reply With Quote