How do I debug scripts that use win32ole?

3

How do I debug scripts that use win32ole?

For example, I found via trial and error that the following Ruby script doesn't work because excessively_long_range is too long:

require "win32ole"
# Boring initialization stuff
excel = WIN32OLE.new('Excel.Application')
excel.Visible = 1
workbook = excel.Workbooks.Add
worksheet = workbook.Worksheets.Add
# Relevant part
excessively_long_range = "B297:K300,M297:V300,B304:K307,M304:V307,B311:K314,M311:V314,B318:K321,M318:V321,B325:K328,M325:V328,B332:K335,M332:V335,B339:K342,M339:V342,B346:K349,M346:V349,B353:K356,M353\n:V356,B360:K363,M360:V363,B367:K370,M367:V370,B374:K377,M374:V377,B381:K384,M381:V384"
worksheet.Range(excessively_long_range)

Gives

WIN32OLERuntimeError: (in OLE method `Range': )
    OLE error code:800A03EC in <Unknown>
      <No Description>
    HRESULT error code:0x80020009
      Exception occurred.
        from (irb):9:in `method_missing'
        from (irb):9
        from c:/Ruby19/bin/irb:12:in `<main>'

Googling 800A03EC and 0x80020009 doesn't help much. Is there anything other than trial and error I could use to determine why it didn't work?

ruby
debugging
win32ole
asked on Stack Overflow Feb 28, 2011 by Andrew Grimm

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0