OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Other Instructions<br />
End Sub<br />
& "Text: " & maItem.aText<br />
Example 2: Case statement<br />
In Cells and Ranges, the following example has the qualifiers in the Case statements written out completely, for<br />
clarity. You can write it more easily, this way:<br />
Dim Doc As Object<br />
Dim Sheet As Object<br />
Dim Cell As Object<br />
Doc = ThisComponent<br />
Sheet = Doc.Sheets(0)<br />
Cell = Sheet.getCellByPosition(1,1) 'Cell "B2" (0-based!)<br />
Cell.Value = 1000<br />
With com.sun.star.table.CellContentType<br />
Select Case Cell.Type<br />
Case .EMPTY<br />
MsgBox "Content: Empty"<br />
Case .VALUE<br />
MsgBox "Content: Value"<br />
Case .TEXT<br />
MsgBox "Content: Text"<br />
Case .FORMULA<br />
MsgBox "Content: Formula"<br />
End Select<br />
End With<br />
Notice that the With construct must be entirely outside of the Select construct.<br />
34 <strong>OpenOffice</strong>.<strong>org</strong> 3.2 <strong>BASIC</strong> <strong>Guide</strong> · March 2010