A
andyh47
I'm writing a report generator which uses word for formatting. In
expermeniting with win32ole this code works:
require 'win32ole'
w = WIN32OLE.new('Word.Application')
w.visible=TRUE
w.Documents.Add
doc=w.ActiveDocument
doc.Content.Font.Name = 'Arial'
doc.Content.Font.Size = 10
doc.Content.Font.Bold = TRUE
selection = w.selection
selection.typetext "Hello World"
However when I add this line to get the cursor positon:
curpos = selection.Information['wdHorizontalPositionRelativeToPage']
I get this error. does anyone know why? thanks for the help.
C:/PROGRA~1/Ruby/work/bell05/efo~7.rb:14:in `method_missing': Information
(WIN32OLERuntimeError)
OLE error code:0 in <Unknown>
<No Description>
HRESULT error code:0x8002000e
Invalid number of parameters. from
C:/PROGRA~1/Ruby/work/bell05/efo~7.rb:14
The offending command works when executed in VBWord.
expermeniting with win32ole this code works:
require 'win32ole'
w = WIN32OLE.new('Word.Application')
w.visible=TRUE
w.Documents.Add
doc=w.ActiveDocument
doc.Content.Font.Name = 'Arial'
doc.Content.Font.Size = 10
doc.Content.Font.Bold = TRUE
selection = w.selection
selection.typetext "Hello World"
However when I add this line to get the cursor positon:
curpos = selection.Information['wdHorizontalPositionRelativeToPage']
I get this error. does anyone know why? thanks for the help.
C:/PROGRA~1/Ruby/work/bell05/efo~7.rb:14:in `method_missing': Information
(WIN32OLERuntimeError)
OLE error code:0 in <Unknown>
<No Description>
HRESULT error code:0x8002000e
Invalid number of parameters. from
C:/PROGRA~1/Ruby/work/bell05/efo~7.rb:14
The offending command works when executed in VBWord.