|
- Sub ruby2()
- '须安装ACTIVERUBY.才能运行
- '下载地址 http://www.artonx.org/data/asr/ActiveRuby.msi
- Set x = CreateObject("scriptcontrol")
- x.Language = "rubyscript"
- y = x.eval("def aa aa,bb,cc ;$aa=aa;$kk=bb;$ll=cc;end;")
- y = x.Run("aa", Sheet1.UsedRange.Value, [j2].Value, [j3].Value)
- y = x.eval("zz=0;arr='';bb=$aa[6..-1].reverse.map{|x|x[10]};catch (:aaa) do;(2..bb.size-1).each{|x|bb.combination(x).to_a.each{|y|mm=y.inject(&:+);arr=mm.to_s+'='+y.inspect.to_s and throw(:aaa) if mm==$kk };};end;arr;")
- MsgBox y
- y = x.eval("zz=0;arr='';bb=$aa[6..-1].reverse.map{|x|x[10]};catch (:aaa) do;(2..bb.size-1).each{|x|bb.combination(x).to_a.each{|y|mm=y.inject(&:+);arr=mm.to_s+'='+y.inspect.to_s and throw(:aaa) if mm==$ll };};end;arr;")
- MsgBox y
- End Sub
复制代码 |
|