H
H.A. de Wilde
L.S.,
I have an Excel Workbook with a VBA Project containing 2 User Forms
with each a Command Button.
User Form 1:
'*************************
Option Explicit
Private Sub CmdUserForm1_Click()
ShowMessage
End Sub
Function ShowMessage()
MsgBox "test"
End Function
'*************************
Clicking on Command Button CmdUserForm1 results correctly in a Message
Box
showing the text "test" using the Funcion ShowMessage.
I like to use the Function ShowMessage also with User Form 2.
User Form 2:
'*************************
Option Explicit
Private Sub CmdUserForm2_Click()
ShowMessage
End Sub
'*************************
Unfortunately clicking on Command Button CmdUserForm2 results in an
Error Message: "Sub or Function not defined"
Of course I can add the Function also to User Form 2:
'*************************
Option Explicit
Private Sub CmdUserForm2_Click()
ShowMessage
End Sub
Function ShowMessage()
MsgBox "test"
End Function
'*************************
but does there exist a method to use the above mentioned Function with
both User Forms without adding the Function to both User Forms?
I have an Excel Workbook with a VBA Project containing 2 User Forms
with each a Command Button.
User Form 1:
'*************************
Option Explicit
Private Sub CmdUserForm1_Click()
ShowMessage
End Sub
Function ShowMessage()
MsgBox "test"
End Function
'*************************
Clicking on Command Button CmdUserForm1 results correctly in a Message
Box
showing the text "test" using the Funcion ShowMessage.
I like to use the Function ShowMessage also with User Form 2.
User Form 2:
'*************************
Option Explicit
Private Sub CmdUserForm2_Click()
ShowMessage
End Sub
'*************************
Unfortunately clicking on Command Button CmdUserForm2 results in an
Error Message: "Sub or Function not defined"
Of course I can add the Function also to User Form 2:
'*************************
Option Explicit
Private Sub CmdUserForm2_Click()
ShowMessage
End Sub
Function ShowMessage()
MsgBox "test"
End Function
'*************************
but does there exist a method to use the above mentioned Function with
both User Forms without adding the Function to both User Forms?