excel - VBA: how to pass a form as a paramter -


i have simple user form button on it. want pass form function in module - inside same module, not work expected:

private sub test(byref oform msforms.userform)     debug.print "caption: >" & oform.caption & "<" end sub  private sub commandbutton3_click()     debug.print "caption: >" & me.caption & "<"     test me     debug.print "caption: >" & me.caption & "<" end sub 

when click button prints debug console:

caption: >userform1< caption: >< caption: >userform1< 

so inside of test() sub caption blank.

any ideas why not work?

note: if use variant parameter-type works

type userform not directly equivalent instance of specific user form , presents different interface.

pass form as object:

private sub test(form object) 

or type safe approach userform may implement interface:

private sub test(form imyform) 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -