ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to click the button from module? (https://www.excelbanter.com/excel-programming/339423-how-click-button-module.html)

OKLover[_2_]

How to click the button from module?
 
Hi, all

Does it possible to click the commandbutton(or activate the
commandbutton_click event) on the userform from the global module?

Tom Ogilvy

How to click the button from module?
 
If you make it public instead of private

Public Sub CommandButton1_Click()

end Sub

then in another module you can do

Sheet1!CommandButton1_Click

Where sheet1 is the code name of the sheet containing the code.
--
Regards,
Tom Ogilvy

"OKLover" wrote in message
...
Hi, all

Does it possible to click the commandbutton(or activate the
commandbutton_click event) on the userform from the global module?




OKLover[_2_]

How to click the button from module?
 
What if the commandbutton is on the userform? how to call it?

"Tom Ogilvy" wrote:

If you make it public instead of private

Public Sub CommandButton1_Click()

end Sub

then in another module you can do

Sheet1!CommandButton1_Click

Where sheet1 is the code name of the sheet containing the code.
--
Regards,
Tom Ogilvy

"OKLover" wrote in message
...
Hi, all

Does it possible to click the commandbutton(or activate the
commandbutton_click event) on the userform from the global module?





Harald Staff

How to click the button from module?
 
Sub Demo()
Call UserForm1.CommandButton1_Click
End Sub


HTH. Best wishes Harald

"OKLover" skrev i melding
...
What if the commandbutton is on the userform? how to call it?

"Tom Ogilvy" wrote:

If you make it public instead of private

Public Sub CommandButton1_Click()

end Sub

then in another module you can do

Sheet1!CommandButton1_Click

Where sheet1 is the code name of the sheet containing the code.
--
Regards,
Tom Ogilvy

"OKLover" wrote in message
...
Hi, all

Does it possible to click the commandbutton(or activate the
commandbutton_click event) on the userform from the global module?







OKLover[_2_]

How to click the button from module?
 
Thank you

"Harald Staff" wrote:

Sub Demo()
Call UserForm1.CommandButton1_Click
End Sub


HTH. Best wishes Harald

"OKLover" skrev i melding
...
What if the commandbutton is on the userform? how to call it?

"Tom Ogilvy" wrote:

If you make it public instead of private

Public Sub CommandButton1_Click()

end Sub

then in another module you can do

Sheet1!CommandButton1_Click

Where sheet1 is the code name of the sheet containing the code.
--
Regards,
Tom Ogilvy

"OKLover" wrote in message
...
Hi, all

Does it possible to click the commandbutton(or activate the
commandbutton_click event) on the userform from the global module?








All times are GMT +1. The time now is 05:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com