From: Ammon Christiansen Date: 2006-01-18T02:30:30+09:00 Subject: Re: ruby as excel vba event handler replacement using win32ole? ------=_Part_3631_6122306.1137519017291 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Thanks, I'll try that! That is the kind of thing I was looking for - event handling in Ruby. On 1/16/06, Masaki Suketa wrote: > > Hello, > In message "ruby as excel vba event handler replacement using win32ole?" > on 06/01/13, Ammon Christiansen writes= : > > > Can ruby be used interactively to process events that would usually be > > handled in VBA in Excel for example? > > Does WIN32OLE_EVENT class help you? > > require 'win32ole' > > def sheet_changed(arg1, arg2) > p arg1.value > end > > excel =3D WIN32OLE.new("Excel.Application") > excel.visible =3D true > book =3D excel.workbooks.Add > ev =3D WIN32OLE_EVENT.new(book, 'WorkbookEvents') > ev.on_event('SheetChange'){|arg1, arg2| > sheet_changed(arg1, arg2) > } > > book.Worksheets(1).Range("A1").value =3D 100 > book.Worksheets(1).Range("A2").value =3D 200 > book.Worksheets(1).Range("B1").value =3D 300 > > > > ------=_Part_3631_6122306.1137519017291--