简体   繁体   中英

Excel 2011 Mac VBA Combobox value

In excel 2011 on the mac, I have a spread sheet with two controls. A combobox and a button. the combo box is named Crops and i want to access the value of that box when clicking the button.

The obvious Crops.Value that would work in windows office does not seem to work and i get an error saying the Crops object is missing.

Is this (simple) task possible with VBA on the Mac?

ok solved it. Active X objects do not work on the mac. You have to use Forms elements and then if you want to access the value of a dropdown this is the VBA code. Hope it helps someone else.

assuming Crops was the combobox, Itm will have the value.

With ActiveSheet.DropDowns("Crops")
    Itm = .list(.ListIndex)
End With

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM