Date: prev next · Thread: first prev next last


Abeさん
早速回答いただきましてありがとうございます。

オフィスソフトのマクロは初体験でして
まずはテストをしようとしたのですが・・・
http://www.slideshare.net/78tch/lib-o-basic
このスライドを参考にしながら
https://help.libreoffice.org/Basic/Write_Statement_Runtime/ja
に置いてある例の出力ファイル名だけ変えて

REM ***** BASIC *****
Sub ExampleWrite
Dim iCount As Integer
Dim sValue As String
iCount = Freefile
Open "C:¥ユーザー¥Sage¥デスクトップ¥TestFile.txt" For Output As iCount
sValue = "Hamburg"
Write #iCount,sValue,200
sValue = "New York"
Write #iCount,sValue,300
sValue = "Miami"
Write #iCount,sValue,450
Close #iCount
End Sub

という内容にしたマクロを作成しました。
そして、Open文はファイルを自動的に作らないようでしたので
TestFile.txt というファイルをデスクトップ上に作成してから、
このマクロを実行してみました。
しかし、実行後に
TestFile.txt
の中身を見てみても何も書き出されていません。
初歩的と思われることで申し訳ないのですが、
どのようにすればきちんと書き出されるようにできるでしょうか?
よろしくお願いします。

Mutou Sage



2016年1月10日 8:32 Takeshi Abe <tabe@fixedpoint.jp>:

Mutouさん

On Sat, 9 Jan 2016 23:24:35 +0800, Mutou Sage <mutousage@gmail.com> wrote:
DDE関数から得られている値がリアルタイムで表示されているセル
(B3,B4が目的のセルとします)
の内容を

# B3,B4
5,8
18,3
4,23
(続く)

といった感じに、たとえば10秒おきなどと時間感覚を定めて
csvファイルの中に連続して書き出させていくにはどうすればよろしいでしょうか?
BASICマクロでやろうとするなら、append modeでターゲットのCSVファイルをOpen[1]
して、Write[2]でセルの値を書き出し、10秒間待つためにWait[3]を使うことで実現
できるのではないでしょうか。

[1] https://help.libreoffice.org/Basic/Open_Statement_Runtime/ja
[2] https://help.libreoffice.org/Basic/Write_Statement_Runtime/ja
[3] https://help.libreoffice.org/Basic/Wait_Statement_Runtime/ja

-- Takeshi Abe


-- 
Unsubscribe instructions: E-mail to users+unsubscribe@ja.libreoffice.org
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/ja/users/
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.