excel - Modify an already loaded userform from a different workbook? -


i have workbook launches userform in background (book2). userform preloaded data step previous not control. want change these values on uf workbook (book1). have no control on when data entered userform , see resulting values on loaded uf, after loads.

so far have been able accomplish book1 set object = userform, , change values form has before gets loaded. while step in right direction, not i'm after. need change uf values after loaded.

sample code book1:

    sub modbk2uf()     dim wkb workbook     dim uf object     each wkb in workbooks         if instr(1, wkb.name, "book2") > 0             set uf = wkb.vbproject.vbcomponents("book2uf")                 uf.designer.controls("label1").caption = "changed value" 'this line changes userform before loads                 'wkb.uf.label1.caption = "changed value" 'object not support property or method                 'uf.label1.caption = "changed value"      'object not support property or method             set uf = nothing         end if     next     end sub 

my guess designer.controls changes preloaded status of userform name suggest. methods such book2uf.label1.caption = "changed value" work fine within book2, because contains userform, not viable in case due me not being able modify code.

i have tried wkb.activate before trying change values, same result.

so again, how 1 change userform values loaded form, workbook?


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -