Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel: reading the cell value if cell is a combobox
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00677059
Message ID:
00677250
Views:
17
Found that the combobox's CELL LINK was not set. Right clicking on the combobox, selecting Format Control, selecting Control tab, i specified the reference (A10 in this case) in the Cell Link parameter. By doing so, the command
?oExcel.ActiveSheet.Range("A10").Value
would return the numeric value that represented the item number in the list. Using the item number, i could then determine the select combobox value.

In another worksheet, the values used to populate the combobox are stored. Something like:

B1=Coors
B2=Bud
B3=Heineken

So, the following returns the "description" of the cell from the 2nd worksheet:
oExcel.ActiveSheet.Range("A10").select       && select combobox cell
cJobCell = ROUND(oExcel.ActiveCell.value,0)  && get combo 'index' value
IF TYPE("cJobCell") = "N"                    && did we get a value
  cJobDesc = "B"+ALLTRIM(STR(oExcel.ActiveCell.value))
  ?oWorkbook.Worksheets[2].range("&cJobDesc").value   && get code from sheet2
ENDIF
shame u cant get the value from the cell unless its CELL LINKed though...


>In trying to determine the cell values from an excel doc, all is fine with the exception of "combobox" values (excel format control ?). Cell A10 in an xls file is a combobox. When i use the following:
>
>
?oExcel.ActiveSheet.Range("A10").Value
>
>The value is empty, but looking at the doc, there is a value in the combobox. How do u determine the value shown in the combo?
Previous
Reply
Map
View

Click here to load this message in the networking platform