2011/11/21 David S. Crampton <[email protected]>:
> I wish to perform some complex arithmetic operations on several variables.
> One such variable is "Firsta" as in the attachment below. I wish to enter
> the values of Firsta (and others) into cells in Calc. The only method I have
> found for entering data into cells is the dispatcher statement using
> "uno:EnterString". This I am using from the Macro recorder script.
>
> The issue appears to be that "uno:EnterString" requires a string as its
> parameter. If the parameter is a numeric (an integer in my case), the cell
> is left empty.
>
> How to enter an integer value from LO Basic into a cell without having to
> klutzy-convert it to a string?  Is there an equivalent to Calc's "Text(ref,
> format)" function that will execute in Basic?
>
> I've searched Andrew's book (very good book) and other web resources about
> uno (very bad resources mostly).  Andrew's book, however, doesn't include
> the EnterString method in its uno chapter.
>
> LO v3.4.4 on Windows XP Pro
>
> ~~~~~~~begin code fragment~~~~~~~~~~~~~~~~~
> ~~~~~~~this code works OK only because of the number-to-string
> conversion~~~~~~~~~~~~~~~~~
> Things = 9
> Do
> ' WriteTriplet0
> dim args5(1) as new com.sun.star.beans.PropertyValue
>        args5(0).Name = "By"
>        args5(0).Value = 1
>        args5(1).Name = "Sel"
>        args5(1).Value = false
> dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args5())
> Select Case Firsta
>        Case 1
>  args1(0).Value = "1"
>        Case 2
>  args1(0).Value = "2"
>        Case 3
>  args1(0).Value = "3"
>        Case 4
>  args1(0).Value = "4"
> End Select
>
> dispatcher.executeDispatch(document, ".uno:EnterString", "", 0, args1())
>
> Firsta = Firsta + 1
> Loop While Firsta <= Things
> ~~~~~~~end code fragment~~~~~~~~~~~~~~~~~
>
>
> --
> David S. Crampton

Is there a reason why you want to use that UNO dispatcher thing or
whatever it is called. Why not just doing something like the
following?
Dim x As Integer
x=3
ThisComponent.getSheets().getByIndex(0).getCellByPosition(0,0).setValue(x)

Well, something like that, I didn't test it.


Kind regards

Johnny Rosenberg
ジョニー・ローゼンバーグ

-- 
For unsubscribe instructions e-mail to: [email protected]
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Reply via email to