VBA to Ruby code translate

Discussion in 'Ruby' started by chen li, Dec 3, 2006.

  1. chen li

    chen li Guest

    Hi all,

    I know I post this question a while ago in Ruby-forum
    but I haven't figure out the solution yet. I hope
    someone from Ruby-talk can help me out to translate
    VBA code into ruby code.

    Thanks,

    Li


    In my ruby script I include these on the top

    require 'win32ole'
    module Excel_Const
    end

    excel=WIN32OLE.new('Excel.Application')
    WIN32OLE.const_load(excel, Excel_Const)
    ...

    I already create a worksheet object and a chart object
    and draw a graph. Also I translate all excel constants

    into Excel_Const::Xxx format
    Then I want to add some errorbars, which have the
    following VBA code :

    ActiveSheet.Shapes("Chart 1").IncrementLeft -133.5
    ActiveSheet.Shapes("Chart 1").IncrementTop 9#
    ActiveChart.SeriesCollection(1).Select
    ActiveChart.SeriesCollection(1).ErrorBar
    Direction:=xlY, Include:=xlBoth, _
    Type:=xlCustom, Amount:="=Sheet1!R5C2:R5C6",
    MinusValues:= _
    "=Sheet1!R5C2:R5C6"
    ActiveChart.SeriesCollection(2).Select
    ActiveChart.SeriesCollection(2).ErrorBar
    Direction:=xlY, Include:=xlBoth, _
    Type:=xlCustom, Amount:="=Sheet1!R6C2:R6C6",
    MinusValues:= _
    "=Sheet1!R6C2:R6C6"






    ____________________________________________________________________________________
    Have a burning question?
    Go to www.Answers.yahoo.com and get answers from real people who know.
    chen li, Dec 3, 2006
    #1
    1. Advertising

  2. chen li

    Li Chen Guest


    > ActiveChart.SeriesCollection(1).Select
    > ActiveChart.SeriesCollection(1).ErrorBar
    > Direction:=xlY, Include:=xlBoth, _
    > Type:=xlCustom, Amount:="=Sheet1!R5C2:R5C6",
    > MinusValues:= _
    > "=Sheet1!R5C2:R5C6"


    Hi all,

    I just figure out how to translate the above VBA code into Ruby code:
    changes some of them into a hash in Ruby

    ...
    activeChart.SeriesCollection(1).Select
    activeChart.SeriesCollection(1).ErrorBar(
    'Direction' => ExcelConst::XlY,
    'Include'=>ExcelConst::XlBoth,
    'Type'=>ExcelConst::XlCustom,
    'Amount'=>"=Sheet1!R5C2:R5C6",
    'MinusValues'=>"=Sheet1!R5C2:R5C6"
    )

    --
    Posted via http://www.ruby-forum.com/.
    Li Chen, Dec 3, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?d2hvZHVuaXQ=?=

    using VBA Access code

    =?Utf-8?B?d2hvZHVuaXQ=?=, Apr 17, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    512
    =?Utf-8?B?d2hvZHVuaXQ=?=
    Apr 17, 2005
  2. Alexandr N Zamaraev

    Help to translate simple VBA code to Python

    Alexandr N Zamaraev, Feb 11, 2008, in forum: Python
    Replies:
    0
    Views:
    484
    Alexandr N Zamaraev
    Feb 11, 2008
  3. Si
    Replies:
    4
    Views:
    225
    Bob Barrows
    Oct 22, 2003
  4. Li Chen
    Replies:
    3
    Views:
    142
  5. Li Chen

    VBA to Ruby code again

    Li Chen, Nov 30, 2006, in forum: Ruby
    Replies:
    7
    Views:
    201
    Li Chen
    Dec 1, 2006
Loading...

Share This Page