1

I am using Excel 2013. I have added an activex control to my spreadsheet. The control is a checkbox which I have named chkAD1. My spreadsheet is called "timeseries_AD".

I am trying to reference the checkbox to check its value however without any joy. I have tried the lines below,

 worksheets("timeseries_AD").OleObjects("chkAD1").Value

This results in the error message "unable to get the OLEObjects property of the worksheet class".

I have read that an activex control has two names. One is the name of the shape that contains the control the other is the code name. I'm not sure which one I have changed. I clicked on my control and in the Name Box renamed it to "chkAD1". Is that the shape name or code name I have changed?

UPDATE - Apologies

Sorry the control I added is not an activex control it is actually a form control.

asked Sep 24, 2014 at 8:16
10
  • go to the sheet with the checkbox. get in design mode (button next to insert button) and then in design mode double click the checkbox. Commented Sep 24, 2014 at 8:22
  • What does Msgbox worksheets("timeseries_AD").Shapes("chkAD1").Name return? An error? Commented Sep 24, 2014 at 8:23
  • @Goosebumbs I'm in design mode and double clicking on the control doesn't do anything? Commented Sep 24, 2014 at 8:28
  • @Rory that line returns me the name i.e. "chkAD1" Commented Sep 24, 2014 at 8:29
  • make sure you select the checkbox before you double click it Commented Sep 24, 2014 at 8:29

1 Answer 1

2

I tried this and it worked for me.
When I check the box I get a messagebox that says TRUE.
And when I uncheck it I get a messagebox that says FALSE

Private Sub CheckBox1_Click()
 MsgBox CheckBox1.Value
End Sub
answered Sep 24, 2014 at 8:44
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.