OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
OpenOffice.org BASIC Guide - OpenOffice.org wiki
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
characters. Internally, <strong>OpenOffice</strong>.<strong>org</strong> Basic saves the associated Unicode value for every character. The working<br />
memory needed for a string variable depends on the length of the string.<br />
Example declaration of a string variable:<br />
Dim Variable As String<br />
You can also write this declaration as:<br />
Dim Variable$<br />
Note – VBA : When porting VBA applications, ensure that the maximum allowed string length in<br />
<strong>OpenOffice</strong>.<strong>org</strong> Basic is observed (65535 characters).<br />
Specification of Explicit Strings<br />
To assign an explicit string to a string variable, enclose the string in quotation marks (").<br />
Dim MyString As String<br />
MyString = " This is a test"<br />
Strings<br />
To split a string across two lines of code, add an ampersand sign (the concatenation operator) and the underscore<br />
continuation character at the end of the first line:<br />
Dim MyString As String<br />
MyString = "This string is so long that it " & _<br />
"has been split over two lines."<br />
To include a quotation mark (") in a string, enter it twice at the relevant point:<br />
Dim MyString As String<br />
MyString = "a ""-quotation mark." ' produces a "-quotation mark<br />
Numbers<br />
<strong>OpenOffice</strong>.<strong>org</strong> Basic supports five basic types for processing numbers:<br />
Integer<br />
Long Integer<br />
Single<br />
Double<br />
Currency<br />
Integer Variables<br />
Integer variables can store any whole number between -32768 and 32767. An integer variable can take up to two<br />
bytes of memory. The type declaration symbol for an integer variable is %. Calculations that use integer variables<br />
are very fast and are particularly useful for loop counters. If you assign a floating point number to an integer<br />
variable, the number is rounded up or down to the next whole number.<br />
Example declarations for integer variables:<br />
Dim Variable As Integer<br />
Dim Variable%<br />
Long Integer Variables<br />
Long integer variables can store any whole number between –2147483648 and 2147483647. A long integer<br />
variable can takes up to four bytes of memory. The type declaration symbol for a long integer is &. Calculations<br />
Chapter 2 · The Language of <strong>OpenOffice</strong>.<strong>org</strong> <strong>BASIC</strong> 13