Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


谷です。

bugzillaに要望として登録しようとしたのですが、そもそもどういう動きを
することが要望として適切なのか、わかりませんでした。
VBASupport が on の場合は ThisWorkbook を予約語として優先する、あるいは
マクロを含む Excel ファイルを ods にしたときに ThisWorkbook モジュールを
作らない、という動作になればいいかなと思います。

モジュールのほうのThisWorkbookにはドキュメントに対するイベント類が記述されている
可能性がありますので、前者かなと思います。

# 前者の修正が簡単なのかどうかよくわかりませんが。
# 安易な修正はエンバグのもとになりそうな話ですしねー。

2012年7月4日 19:39 Takeshi Abe <tabe@fixedpoint.jp>:
毛井さん

安部です。
下記の情報ありがとうございます。

On Tue,  3 Jul 2012 18:24:46 +0900, Hirono Moi <hmoi@ashisuto.co.jp> wrote:
例えば、以下のVBAを持つEXCElファイルがあるとします。

      Sub Main()
          ThisWorkbook.Worksheets("Sheet3")
      End Sub

このEXCELファイルをCALCで開き、ods形式で保存し、いったんファイルを
閉じます。
ods形式に保存したファイルをcalcで開いて、このVBAマクロを実行すると、
以下のエラーとなります。
      BASICランタイムエラー
      '423'
      Worksheets

モジュール名「ThisWorkbook」が存在し、コード中の「ThisWorkbook」と
衝突することが影響して発生してるようです。

モジュール「ThisWorkbook」を削除すると、元々の期待する動作:Sheet3を
選択します。
LibreOffice 3.5.4 で試したところ上記の振舞いが再現しました。
元の Excel ファイルをそのまま読み込んでマクロを実行するとエラーにならない
ところもポイントですね。


このモジュール「ThisWorkbook」は、LibreOfficeがVBAマクロを含むEXCEL
ファイルを読み込むときに、VBAモジュールから自動的に生成しています。

モジュール「ThisWorkbook」があるから、この423エラーが発生する、、、
確かにその通りなのですが。。。
生成される ThisWorkbook モジュールは空っぽでした。
ThisWorkbook という VBA での特別な属性より、こちらの ThisWorkbook を優先
しているのが問題のようです。


bugzillaに要望として登録しようとしたのですが、そもそもどういう動きを
することが要望として適切なのか、わかりませんでした。
VBASupport が on の場合は ThisWorkbook を予約語として優先する、あるいは
マクロを含む Excel ファイルを ods にしたときに ThisWorkbook モジュールを
作らない、という動作になればいいかなと思います。

-- Takeshi Abe


皆様、どう思われるでしょうか?

--
Hirono Moi

--
Unsubscribe instructions: E-mail to discuss+help@ja.libreoffice.org
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/ja/discuss/
All messages sent to this list will be publicly archived and cannot be deleted


--
Unsubscribe instructions: E-mail to discuss+help@ja.libreoffice.org
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/ja/discuss/
All messages sent to this list will be publicly archived and cannot be deleted


-- 
Unsubscribe instructions: E-mail to discuss+help@ja.libreoffice.org
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/ja/discuss/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.