excel vba, userforms and events: modeless user form that can accept events -
my excel book contains user form called myuserform
. want open it, fill info , programmatically press button. textboxes input info have beforeupdate , afterupdate handlers.
if phone call call userform2.show
, these events run, seem unable unload form (calling call userform2.show
pauses execution of excel marco until manually close it).
if phone call don't call userform2.show
(or phone call in modeless mode), info population fine, excel beforeupdate , afterupdate handlers ignored.
sample code:
in module:
public function s(byval newvalue string) string 'call userform2.show userform2.textbox1.value = newvalue userform2.repaint s = userform2.textbox1.value userform2.button1_click end function public function s2() string s2 = s("newvalue") end function
in user form:
public sub button1_click() unload me end sub public sub textbox1_afterupdate() textbox1.value = textbox1.value + "y" end sub
you want open form fill info close no user interaction? why bother opening form @ all.
other move unload me code end of form load event, or form activat event... although might not work, worth try, sorry can't test not on pc.
excel excel-vba automation excel-2010 userform
No comments:
Post a Comment