Passing optional argument to win32 ole subsystem

Hi all,
I am trying to embed a html document in Excel document using Win32OLE.
The VBA Excel reference talks about this by using the OleObject Add
method.
However I am not sure how do I pass the optional argument in ruby which
OLE
will understand. Following is the snippet of the sample from VBA
refernce.

==============
|Set myDocument = Worksheets(1)
myDocument.Shapes.AddOLEObject Left:=100, Top:=100, _ Width:=200,
Height:=300, _ FileName:=“c:\my documents\testing.doc”, link:=True|

I tried passing null, but it failed miserably. I am not sure if I pass
some argument incorrectly
or the method I am using to pass the arguments is incorrect.
Can somebody let me know the exact syntax in ruby to make this call
successful.
Any relevant pointers will be appreciated.

Thanks and Regards,
Manish

On 2/22/07, Manish S. [email protected] wrote:

==============
Manish
http://ruby-doc.org/docs/ProgrammingRuby/html/win32.html#UB

Named Arguments

Other automation client languages such as Visual Basic have the
concept of named arguments. Suppose you had a Visual Basic routine
with the signature:

Song(artist, title, length): rem Visual Basic

Instead of calling it with all three arguments in the order specified,
you could use named arguments.

Song title := ‘Get It On’: rem Visual Basic

This is equivalent to the call Song(nil, ‘Get It On’, nil).

In Ruby, you can use this feature by passing a hash with the named
arguments.

Song.new( ‘title’ => ‘Get It On’ )


So basically you just name those arguments you actually need:

myDocument.Shapes.AddOLEObject( ‘Left’ => 100, ‘Top’ => 100, ‘Width’ =>
200,
‘Height’ => 300, ‘FileName’ => “c:\my documents\testing.doc”, ‘link’
=> true)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs