Hello,

Bulhac Mihai wrote:

> what can i use instead?, i dont want to use fillinrange; and how can i
> go to another worksheet after i selected a option in the combo box

Sorry, I had not noticed your second question.

Try to use WIN32OLE_EVENT and 'MdcComboEvents'.

require 'win32ole'
ex = WIN32OLE.new('Excel.Application')
ex.visible = true
book = ex.workbooks.add
sheet = book.worksheets(1)
combo = sheet.OLEObjects.Add("Forms.Combobox.1").object

book.worksheets.each do |sheet|
   combo.additem(sheet.name)
end
combo.additem("exit ruby")

ev = WIN32OLE_EVENT.new(combo, 'MdcComboEvents')
ev.on_event('Change'){|*arg|
   if combo.text == 'exit ruby'
     $LOOP = false
   else
     book.worksheets(combo.text).activate
   end
}
$LOOP = true
while $LOOP
   WIN32OLE_EVENT.message_loop
   sleep 0.1
end