jdub12280
08-14-2010, 10:51 AM
Hello experts,
:help
I have a userform that includes a 4 page multipage. Each page has ~ 10 buttons. Each button is captioned within the userform initialize event. Each button serves basically the same purpose on different ranges. I have a msg box ask the user if they really want to do what they clicked... So there are about 40 cmdClick subs... i want the msg to to use the "buttonclicked".caption (me.caption wasn't scoped to the button but to the form)
I would like to replace the "me.cmdHorn1.caption" with something like me.caption where "me" refers to the button actually clicked within the multi page. (4 multipage pages aprox 10+ buttons each page)
Sample button sub with msgbox below:
(cmdHorn1_Click is a 1 example of 40 different buttons... all have the same naming convention)
Private Sub cmdHorn1_Click()
answer = MsgBox(msgP1 & Me.cmdHorn1.Caption & msgP2, vbOKCancel, "Click OK to Update")
If answer = vbCancel Then Exit Sub ' the macro ends if the user selects the CANCEL-button
Unload Me
Application.WindowState = xlMinimized
WB_SettingsOFF
On Error GoTo ResetWorkbookSettings:
If ActiveSheet.Name <> "LINKS" Then Sheets("LINKS").Select
Set LinkTable = ActiveSheet.Range("L5:U5")
For Each Rng In LinkTable
Rng.Select
Application.Run "UpdateLinks"
Next Rng
Sheets("LINKS").Range("A1").Select
WB_SettingsON
Application.WindowState = xlMaximized
MsgBox msgP3 & Me.cmdHorn1.Caption & msgP4, vbInformation
Exit Sub
ResetWorkbookSettings:
'Err.Clear
WB_SettingsON
Application.WindowState = xlMaximized
End Sub
Any help or direction... as always... is greatly appreciated :)
Thanks - Justin
:help
I have a userform that includes a 4 page multipage. Each page has ~ 10 buttons. Each button is captioned within the userform initialize event. Each button serves basically the same purpose on different ranges. I have a msg box ask the user if they really want to do what they clicked... So there are about 40 cmdClick subs... i want the msg to to use the "buttonclicked".caption (me.caption wasn't scoped to the button but to the form)
I would like to replace the "me.cmdHorn1.caption" with something like me.caption where "me" refers to the button actually clicked within the multi page. (4 multipage pages aprox 10+ buttons each page)
Sample button sub with msgbox below:
(cmdHorn1_Click is a 1 example of 40 different buttons... all have the same naming convention)
Private Sub cmdHorn1_Click()
answer = MsgBox(msgP1 & Me.cmdHorn1.Caption & msgP2, vbOKCancel, "Click OK to Update")
If answer = vbCancel Then Exit Sub ' the macro ends if the user selects the CANCEL-button
Unload Me
Application.WindowState = xlMinimized
WB_SettingsOFF
On Error GoTo ResetWorkbookSettings:
If ActiveSheet.Name <> "LINKS" Then Sheets("LINKS").Select
Set LinkTable = ActiveSheet.Range("L5:U5")
For Each Rng In LinkTable
Rng.Select
Application.Run "UpdateLinks"
Next Rng
Sheets("LINKS").Range("A1").Select
WB_SettingsON
Application.WindowState = xlMaximized
MsgBox msgP3 & Me.cmdHorn1.Caption & msgP4, vbInformation
Exit Sub
ResetWorkbookSettings:
'Err.Clear
WB_SettingsON
Application.WindowState = xlMaximized
End Sub
Any help or direction... as always... is greatly appreciated :)
Thanks - Justin