excel - Reference a check box in another open workbook -


i trying refer value of activex checkbox control in worksheet. goal make value of check box in current workbook same 1 in open workbook.

i can between 2 checkboxes in same workbook on different sheets:

private sub commandbutton1_click()  if sheets("sheet2").box2.value = true     box1.value = true else: box1.value = false end if  end sub 

but i'm receiving run-time error '9' "subscript out of range" error when run following code:

private sub commandbutton2_click()  if worksheets("book2").oleobjects("box3").value = true     box1.value = true else: box1.value = false end if 

end sub

the "if worksheets" line highlighted when try debug code. i'm sure i'm referring other checkbox incorrectly, i've searched high , low proper way refer without luck. thank in advance help!

if worksheets("book2").oleobjects("box3").value = true 

"book2" not name of worksheet, presumably name of other book. in case:

if workbooks("book2").worksheets(1).oleobjects("box3").value = true 

..or use whatever name of worksheet in other book called.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -