1
votes

I would like to refer ActiveX ComboBox value from module. I put ComboBox which named ComboBox1 into worksheet. This worksheet names is "Setup Sheet" and code name "SetupSheet". And i want to read value of combo box from my module named SettingsModule.

Debug.Print ThisWorkbook.Sheets("Setup Sheet").ComboBox1.Value

but it gives an error Method or Object not found.

What's wrong with my code?

2

2 Answers

1
votes

The easiest way is to use your worksheet's codename.

This is different from the sheet name as well as the sheet index, so if you are not familiar with codenames at all you might want to read up on it.

In the VBE project explorer, you will see your codenames followed by your sheet names, and it would look something like Sheet1 (Setup Sheet).

Assuming your Setup Sheet's codename is Sheet1, then you could simply use

Sheet1.Combobox1.Value
1
votes

Try replacing .ComboBox1.Value with Shapes("ComboBox1").DrawingObject.Object.Value