[#40081] Module.constantsとModule.const_get — HASHIMUKAI Toshikatsu <hashi@...>
はしむかい、というものです。
4 messages
2004/10/12
[#40085] require 中に例外が発生したときの対処について — SASADA Koichi <ko1@...>
ささだです。
5 messages
2004/10/13
[#40088] Current optparse and iconv? — Takahiro Kambe <taca@...>
こんばんは。
8 messages
2004/10/13
[#40089] Re: Current optparse and iconv?
— nobu@...
2004/10/13
なかだです。
[#40094] 数式処理の型 — Dai Watanabe <dai@...>
わたなべ@ひたち ともうします。
6 messages
2004/10/14
[#40112] win32oleからのマクロの呼び出し — Kazuhiro Oinuma <core379@...>
生沼と申します。
7 messages
2004/10/18
[#40130] Ruby/Tk の講習会 — Hidetoshi NAGAI <nagai@...>
永井@知能.九工大です.
12 messages
2004/10/25
[#40131] 新潟の大地震 — Wakou Aoyama <wakou@...>
(とっても)お久しぶりです。青山です。
6 messages
2004/10/25
[#40142] 求む,もっとましな連結リストの実装 — Hideo Konami <konami@...>
小波です。
5 messages
2004/10/29
[ruby-list:40113] Re: win32oleからのマクロの呼び出し
From:
Masaki Suketa <masaki.suketa@...>
Date:
2004-10-18 22:01:49 UTC
List:
ruby-list #40113
In message "[ruby-list:40112] win32oleからのマクロの呼び出し"
on 04/10/19, Kazuhiro Oinuma <core379@nifty.com> writes:
> 生沼と申します。
>
> win32oleを使ってExcelの自作マクロを呼び出そうとしているのですが、
> 引数あり & 戻り値ありのマクロを Run メソッドで呼び出した場合に、
> 戻り値が取得できません。引数がないマクロならば戻り値が得られるのですが
> これはこういうものなのでしょうか?
>
> 具体的には以下のプログラムです。
>
> test.rb --------------------
> require 'win32ole'
>
> file_system = WIN32OLE.new('Scripting.FileSystemObject')
> file_name = file_system.getAbsolutePathName("test.xls")
> excel = WIN32OLE.new('Excel.Application')
> #WIN32OLE.const_load(excel, Excel)
> excel.visible = true
> book = excel.workbooks.open(file_name)
> puts excel.run("Func1") # ○
> puts excel.run("Func2", "hoge") # ×
> excel.quit
>
> test.xls のマクロ -------
> Public Function Func1() As String
> Func1 = "Func1()"
> End Function
>
> Public Function Func2(strValue As String) As String
> Func2 = "Func2()"
> End Function
>
> 実行結果 ----------------
> $ ruby test.rb
> Func1()
> nil <-- nilになる
>
> なお、VBAで
>
> Public Sub CallFunc2()
> MsgBox Application.Run("Func2", "hoge")
> End Sub
>
> というマクロを作ってFunc2を呼んでやると文字列"Func2"が返ってきました。
>
> 環境は Windows2000 Pro、Excel2000(9.0.2812)、rubyは
> 1.8.1 i386-mswin32版です。win32oleはrubyに搭載されているものを使用しています。
> よろしくお願いします。