如何调试使用win32ole的脚本?
例如,我通过反复试验发现以下Ruby脚本不起作用,因为excessively_long_range
太长了:
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)
给出
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>'
Google搜索800A03EC
和0x80020009
没有多大帮助。除了试验和错误之外还有什么可以用来确定它为什么不起作用?