How to call DblClick sub from code VBA Excel -
i have excel worksheet 2 forms: form1
, form2
.
form1
has textbox1 double-click events:
public sub textbox1_dblclick(byval cancel msforms.returnboolean) ' activity... end sub
form2
has commandbutton2
click event:
private sub commandbutton2_click() ' activity... end sub
i need call textbox1_dblclick
sub commandbutton2_click
sub.
how can make call this?
create new module, add sub operations wish perform
sub mysubroutine() ' stuff end sub
then call both of click handlers
' in form1 public sub textbox1_dblclick(byval cancel msforms.returnboolean) mysubroutine end sub ' in form2 private sub commandbutton2_click() mysubroutine end sub
if wanted pass stuff (like text box strings etc) forms, include input arguments in sub
sub mysubroutine(str string, n long) ' passing arguments ' stuff end sub
then pass arguments when make call anywhere
' string , long data on form, call mysubroutine mysubroutine str:=mystring, n:=mylong
Comments
Post a Comment