Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default OLE combobox

Hi.
I have a little problem...
I have a macro that creates a OLE combobox1, with 3 different selections,
and puts it into a excel worksheet. Then when I have put the combobox into
the worksheet I have an other macro which should get the text from the
combobox and set it into av textbox which will be drawn in Visio. My problem
is to get the text from the combobox.

This code is the one I use to try to get the selected text in the combobox
in the active worksheet.

Dim shpObjComp As Visio.Shape
shpObjComp.Text = Cells(row, column).Select

But the combobox items doesn't get into the shpObjComp, the shpObjComp only
writes out "true"
Please help me! I dont know how to solve this!

/Mikkan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default OLE combobox

Can't say what is wrong without knowing more about your code. How (and why?)
are you computing the values for row and column, and why are you looking for
the text on your sheet via the Cells() property instead of directly from the
Combobox itself?
--
- K Dales


"Mikkan" wrote:

Hi.
I have a little problem...
I have a macro that creates a OLE combobox1, with 3 different selections,
and puts it into a excel worksheet. Then when I have put the combobox into
the worksheet I have an other macro which should get the text from the
combobox and set it into av textbox which will be drawn in Visio. My problem
is to get the text from the combobox.

This code is the one I use to try to get the selected text in the combobox
in the active worksheet.

Dim shpObjComp As Visio.Shape
shpObjComp.Text = Cells(row, column).Select

But the combobox items doesn't get into the shpObjComp, the shpObjComp only
writes out "true"
Please help me! I dont know how to solve this!

/Mikkan

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 253
Default OLE combobox

Hi,

Correct
"Cells(row, column).Select" is True
If you want the value, remove .Select
Regards
JY

"Mikkan" wrote in message
...
Hi.
I have a little problem...
I have a macro that creates a OLE combobox1, with 3 different selections,
and puts it into a excel worksheet. Then when I have put the combobox into
the worksheet I have an other macro which should get the text from the
combobox and set it into av textbox which will be drawn in Visio. My

problem
is to get the text from the combobox.

This code is the one I use to try to get the selected text in the combobox
in the active worksheet.

Dim shpObjComp As Visio.Shape
shpObjComp.Text = Cells(row, column).Select

But the combobox items doesn't get into the shpObjComp, the shpObjComp

only
writes out "true"
Please help me! I dont know how to solve this!

/Mikkan



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default OLE combobox

Hi.
I have a function which makes the 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.combo box.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
standa´rd 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

"K Dales" skrev:

Can't say what is wrong without knowing more about your code. How (and why?)
are you computing the values for row and column, and why are you looking for
the text on your sheet via the Cells() property instead of directly from the
Combobox itself?
--
- K Dales


"Mikkan" wrote:

Hi.
I have a little problem...
I have a macro that creates a OLE combobox1, with 3 different selections,
and puts it into a excel worksheet. Then when I have put the combobox into
the worksheet I have an other macro which should get the text from the
combobox and set it into av textbox which will be drawn in Visio. My problem
is to get the text from the combobox.

This code is the one I use to try to get the selected text in the combobox
in the active worksheet.

Dim shpObjComp As Visio.Shape
shpObjComp.Text = Cells(row, column).Select

But the combobox items doesn't get into the shpObjComp, the shpObjComp only
writes out "true"
Please help me! I dont know how to solve this!

/Mikkan

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
fill combobox depending on selection from another combobox Adam Francis Excel Discussion (Misc queries) 2 July 24th 08 07:39 PM
combobox changes value flow23 Excel Discussion (Misc queries) 0 May 11th 06 04:44 PM
How Do I Load A ComboBox RowSource From The Results Of Another ComboBox Minitman[_4_] Excel Programming 3 October 26th 04 07:58 PM
Populating combobox from another combobox David Goodall Excel Programming 1 September 12th 04 03:42 PM
ComboBox Alex Mackenzie Excel Programming 0 July 2nd 04 08:48 PM


All times are GMT +1. The time now is 11:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"