21.08.2013 Views

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Other Instructions 42<br />

End Sub<br />

Example 2: Case statement<br />

In Cells and Ranges, the following example has the qualifiers in the Case statements<br />

written out completely, for 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 = StarDesktop.CurrentComponent<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 />

Source: http:/ / <strong>wiki</strong>. services. openoffice. <strong>org</strong>/ w/ index. php? title=Documentation/ <strong>BASIC</strong>_<br />

<strong>Guide</strong>/ Other_ Instructions&oldid=107794<br />

Principal Authors: TJFrazier

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!