-------- Original Message --------
From: Andrew Mathenge <[EMAIL PROTECTED]>
Date: Wed 05 Sep 2007 03:04:37 EST

> I don't know if this has been answered, and hopefully the solution is fairly
> simple. I have a spreadsheet with text in it. I'm able to get the text and
> display it using a MsgBox or even copy it to another cell. However, whenever
> I try to assign it to a string, I get the following error:
> 
> Action not supported.
> Invalid Procedure call.
> 
> Here's a small sample of text
> 
> Sub Main
>   Dim t as Object
>   Dim s as String
>   Dim data as String
> 
>   t = ThisComponent.sheets.getByName("Sheet1")
>   s = "This is arbitrary text"
> 
>   MsgBox("Here are the first four letters of s: " & Mid(s,0,4))
> 
>   data = t.getCellByPosition(0,2).getString()
> 
>   MsgBox("The text in A:3 is: " & data)
> 
>   MsgBox("The first four characters of data are: " & Mid(data,0,4)
> End Sub
> 
> Everything works except the last line. It blows up with the error message
> above. The second-to-last MsgBox displays the value of the cell and it's
> correct. The text is about 20 characters long.
> 
> Is this an issue of Mid() not accepting the return value from getString()?
> 
> Any help is greatly appreciated.

Try
Mid(<your_string_variable>,1,4)
instead of
Mid(<your_string_variable>,0,4)

The second parameter in the Mid function is the position of the first
character to be returned.

Hope this helps.

Dave

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to