简体   繁体   中英

Excel MAC VBA Dropdown

on MAC OFFICE 2011 I am trying to get this working: http://www.contextures.com/xlDataVal10.html

There is a sample file that you can download: http://www.contextures.com/DataValCombobox.zip

But when I open the worksheet and click on a cell I get the following error:

"Method or data member not found"

Set cboTemp = ws.OLEObjects("TempCombo")
  On Error Resume Next
If cboTemp.Visible = True Then
  With cboTemp
    .Top = 10
    .Left = 10
    .ListFillRange = ""
    .LinkedCell = ""
    .Visible = False
    .Value = "" <<<- HIGHLIGHTED
  End With
End If

The debugger highlights the .value as indicated above.

What is the cause of this and can it be fixed ?

It's because .Value isn't a property of the ComboBox.

Here is the list of properties you can use.

You are probably looking for

.SelectedValue

or Depending on which column you have the Rowsource bound.

.SelectedIndex

You can also use

.Text

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