Narita さん 安部です。下記の情報ありがとうございます。
こちら(LibO 3.4.4)でもその振舞いが再現しました。 サンプルとしたマクロを含む .ods を以下に置いています: http://fixedpoint.jp/libreoffice/20120124.ods String 型や Variant 型の変数に代入して比べる場合と、文字列リテラルどうしで 比べる場合とで結果が違うようです。 Bugzilla に報告して開発者の方から意見をもらうのがよさそうです。 実際に不具合かどうかは定かではありませんが、少なくとも混乱を招きがちなことは 確かですね。 Basic での文字列の比較には StrComp() を使う、というのが 回避策の1つとして考えられます: http://help.libreoffice.org/3.3/Basic/StrComp_Function_Runtime/ja -- Takeshi Abe On Mon, 23 Jan 2012 00:43:55 +0900, "Mitsuo.Narita" <[email protected]> wrote: > ====== > scalc.exeで バグの症状がありました。 > シート上でc1に「新」、c2に「旧」を入れて、d1セルで=If(c1>c2,0,1)とすると > 0が返されます。 > 新>旧 > ところが > 次のマクロでは混乱しています。 > Sub Main > Dim oCell As Object > Dim sString1 As String, sString2 As String > oCell = ThisComponent.Sheets(0).getCellByPosition(2, 0) 'C1 > sString1 = oCell.String > oCell = ThisComponent.Sheets(0).getCellByPosition(2, 1) 'C2 > sString2 = oCell.String > If sString1 > sString2 Then > MsgBox "C1=" & sString1 & ", C2=" & sString2 & ", C1>C2" > Else > MsgBox "C1=" & sString1 & ", C2=" & sString2 & ", C1<C2" > End If > '----------------------------------- > If "新">"旧" Then > MsgBox "新>旧" > Else > MsgBox "旧>新" > End If > End Sub > > 説明 > 上(----より上)の判定は C1<C2 > 下の判定は 新>旧 > なのです。 > > http://ja.libreoffice.org/download/ > LibO_3.4.5_Win_x86_install_multi.exe 191 MB > LibO_3.4.5_Win_x86_helppack_ja.exe 15 MB (ja - 日本語) > WindowsXP Professional Version 2002 SP3 -- Unsubscribe instructions: E-mail to [email protected] 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
