OLE comboboxes

G

Guest

Hi.
I have a function which makes OLE comboboxes:

Sub newCombo(intRowIndex As Integer, intColumnIndex As Integer, strSignal As
String)

Then I have a select case selection which makes an array with items for the
combobox:
Select Case intRowIndex
Case 18 + 3
varDiff = Array("Sea Water Pressure", "CC_SetPlus")
intDiffLength = 1
.....

Creation of the combobox
With Cells(intRowIndex, intColumnIndex)
'Create a OLE oject and set size and add it to the active sheet
Set oOLE = ActiveSheet.OLEObjects.Add(ClassType:="Forms.combobox.1", _
Left:=.Left, Top:=.Top, Width:=.Width,
Height:=.Height)


combo.AddItem (strSignal)

'Add the other choices to the combobox
For j = 0 To intDiffLength
combo.AddItem (varDiff(j))
Next j
'Set the standard choice to be chosen
combo.ListIndex = 0

Thats the macro which makes the comboboxes and sets the items and the
standard choice.

Then I have another macro which will look in the excel sheet and take the
value of the cell and put in a variable. Then I create a visio document and a
shape and I want to assign the text from the excel sheet to the shape. It
works great for an usuall cell, but it doesn't work for the comboboxes. I
dont know how to take the value from an OLE combobox.

this is what i do to take the value of the excel cell.
shpObjComp.Text = Cells(varPinNrA(i) + 2, intColumn + 1)

Perhaps it would work if the cell which the combobox lies in knows what the
combobox is showing, but i don't know how to do that!
HELP please!

/Mikkan
 
W

William Benson

Doesn't the combo box have a linked cell property, and cannot you take the
value from that cell and not the combo?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top