From: andyh47 Date: 2005-07-07T03:45:50+09:00 Subject: Re: Need help with win320le word interface Thanks very much for your post and the one from Corey. The advice worked like a charm. Thanks very much for your help. "Dave Burt" wrote in message news:V%Cye.15665$oJ.2679@news-server.bigpond.net.au... > "andyh47" asked: >> >> require 'win32ole' >> >> ... >> >> curpos = selection.Information['wdHorizontalPositionRelativeToPage'] > > The above is not a correct translation of the VB code you are using: > curpos = Selection.Information(wdHorizontalPositionRelativeToPage) > > wdHorizontalPositionRelativeToPage is a constant integer whose value is 5. > (Try printing it or displaying it in a msgbox from Word/VBA. > > Furthermore, Information has a required argument, and you need to pass > that as a Ruby argument rather than using the [] operator as you're doing > here. > > Try this: > WdHorizontalPositionRelativeToPage = 5 > curpos = selection.Information(WdHorizontalPositionRelativeToPage) > or this: > module Word; end # you can use whatever name you like instead of Word > WIN32OLE.const_load(w, Word) > curpos = selection.Information(WdHorizontalPositionRelativeToPage) > > Cheers, > Dave >