On 30.12.2013 13:13, David Dawson wrote:
> I've been doing a lot of Excel automation very successfully, my method being
> to record a VB macro
> when I don't know exactly which methods to use.
>
> This works brilliantly, until I come across some VB like this:
>
> Sheets("Report").Copy Before:=Sheets(3)
>
> My problem starts at the word "Before" -- how do I specify these parameters
> in OORexx?
>
> excel~sheets("Report")~copy << now what?
>
> I hope you can help and that I've asked the question in the right place.
What you have been doing successfully is great, transcribing VB scripts to
ooRexx!
There is one thing you should know, that explains what happens in this
particular case, sending the
message "copy" to the ooRexx proxy object: the ooRexx object (an instance of
the ooRexx class
.oleObject) will receive the message and look for a method in its own class
(.oleObject) and if not
found in its superclass (.object), and only if nout found will forward the
message to the Windows
object it stands for.
So whenever the ooRexx object finds such a method in an ooRexx class the object
will activate it. In
your case the method "copy" of the ooRexx root class .object is carried out, so
the message "copy"
will never be forwarded to the Window object the ooRexx proxy objects stands
for.
If you look-up the .oleObject methods you will find a "dispatch" method, that
you can use to make
sure that your "copy" message is forwarded to the Windows object, something
like:
excel~sheets("Report")~dispatch("copy")
So, whenever you intend to send messages to the Windows object that are
implemented in .oleObject or
.object, you should use .oleObject's "dispatch" supplying the name of the
message as the first
argument. (
HTH
---rony
P.S.: As you have experienced, it is very seldom the case that one needs the
explicit dispatch
method to forward a message to the Windows object.
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Oorexx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-users