Collabora Office 24.04 Help
λ€μμ Collabora Office Basicμ λ³μ μ¬μ©μ λν κΈ°λ³Έμ μΈ μ¬νμ μ€λͺ ν κ²μ λλ€.
λ³μ μ΄λ¦μ μ΅λ 255μλ‘ κ΅¬μ±ν μ μμ΅λλ€. λ³μ μ΄λ¦μ 첫 λ²μ§Έ λ¬Έμλ λ°λμ A-Z λλ a-z μ¬μ΄μ λ¬Έμμ¬μΌ ν©λλ€. λ³μ μ΄λ¦μ μ«μλ μ¬μ©ν μ μμ§λ§, λ¬Έμ₯ λΆνΈλ νΉμ λ¬Έμλ μ¬μ©ν μ μμ΅λλ€. λ¨, λ°μ€("_")μ μ¬μ©ν μ μμ΅λλ€. Collabora Office Basicμμ λ³μ νμΈμλ λ/μλ¬Έμλ₯Ό ꡬλΆνμ§ μμ΅λλ€. λ³μ μ΄λ¦μ 곡백μ μ¬μ©ν κ²½μ°μλ ν΄λΉ λ³μλ₯Ό κ°κ΄νΈλ‘ λ¬Άμ΄μΌ ν©λλ€.
λ³μ μλ³μ μ:
MyNumber=5 'Correct'
MyNumber5=15 'Correct'
MyNumber_5=20 'Correct'
My Number=20 'Not valid, variable with space must be enclosed in square brackets'
[My Number]=12 'Correct'
DΓ©jΓ Vu=25 'Not valid, special characters are not allowed'
5MyNumber=12 'Not valid, variable may not begin with a number'
Number,Mine=12 'Not valid, punctuation marks are not allowed'
Collabora Office Basicμμλ λ³μλ₯Ό λͺ μμ μΌλ‘ μ μΈν νμκ° μμ΅λλ€. λ³μ μ μΈμ Dim λ¬Έμ μ¬μ©νμ¬ μνν μ μμ΅λλ€. μΌνλ‘ μ΄λ¦μ ꡬλΆνλ©΄ λ κ° μ΄μμ λ³μλ₯Ό λμμ μ μΈν μ μμ΅λλ€. λ³μ μ νμ μ§μ νλ €λ©΄ μ΄λ¦ λ€μμ μ ν μ μΈ κΈ°νΈλ₯Ό μ¬μ©νκ±°λ ν΄λΉ ν€μλλ₯Ό μ¬μ©ν©λλ€.
λ³μ μ μΈμ μ:
Dim a$ 'Declares the variable "a" as a String'
Dim a As String 'Declares the variable "a" as a String'
Dim a$, b As Integer 'Declares one variable as a String and one as an Integer'
Dim c As Boolean 'Declares c as a Boolean variable that can be TRUE or FALSE'
λ³μλ₯Ό νΉμ μ νμΌλ‘ μ μΈν λ€μμλ ν΄λΉ λ³μλ₯Ό λμΌν μ΄λ¦μ κ°μ§κ³ λ€λ₯Έ μ νμΌλ‘ μ μΈν μ μμ΅λλ€.
When you declare multiple variables in a single line of code you need to specify the type of each variable. If the type of a variable is not explicitly specified, then Basic will assume that the variable is of the Variant type.
' Both variables "a" and "b" are of the Integer type
Dim a As Integer, b As Integer
' Variable "c" is a Variant and "d" is an Integer
Dim c, d As Integer
' A variable can also be explicitly declared as a Variant
Dim e As Variant, f As Double
The Variant type is a special data type that can store any kind of value. To learn more, refer to the section The Variant type below.
λ³μ μ μΈμ κ°μ νλ €λ©΄ λ€μ λͺ λ Ήμ μ¬μ©ν©λλ€.
Option Explicit
Option Explicit λ¬Έμ λͺ¨λμμ 첫 λ²μ§Έ SUB μμ 첫 μ€μ μμ΄μΌ ν©λλ€. μΌλ°μ μΌλ‘ λ°°μ΄λ§ λͺ μμ μΌλ‘ μ μΈν΄μΌ ν©λλ€. λ€λ₯Έ λͺ¨λ λ³μλ μ ν μ μΈ λ¬Έμμ λ°λΌ μ μΈλκ±°λ μ΄ λ¬Έμκ° μμ κ²½μ° κΈ°λ³Έ μ νμΈ Singleλ‘ μ μΈλ©λλ€.
Collabora Office Basicμ λ€μκ³Ό κ°μ λ€ κ°μ§ λ³μ ν΄λμ€λ₯Ό μ§μν©λλ€.
Numeric λ³μλ μ«μ κ°μ ν¬ν¨ν μ μμ΅λλ€. μΌλΆ λ³μλ ν¬κ±°λ μμ μ«μλ₯Ό μ μ₯νλ λ° μ¬μ©λλ©° λ€λ₯Έ λ³μλ λΆλ μμμ λλ λΆμμ μ¬μ©λ©λλ€.
String λ³μλ λ¬Έμμ΄μ ν¬ν¨ν©λλ€.
Boolean λ³μλ TRUE λλ FALSE κ°μ ν¬ν¨ν©λλ€.
Object λ³μλ λ¬Έμ λ΄μ ν μ΄λΈ λ° λ¬Έμ κ°μ λ€μν μ νμ κ°μ²΄λ₯Ό μ μ₯ν μ μμ΅λλ€.
Integer λ³μλ -32768μμ 32767κΉμ§μ λ²μλ₯Ό κ°μ§λλ€. Integer λ³μμ λΆλ μμμ κ°μ ν λΉν κ²½μ° μμμ μ΄ν μλ¦Ώμκ° λ€μ μ μλ‘ λ°μ¬λ¦Όλ©λλ€. Integer λ³μλ νλ‘μμ μμ μ μνκ² κ³μ°λκΈ° λλ¬Έμ 루νμ μΉ΄μ΄ν° λ³μμ μ ν©ν©λλ€. Integer λ³μμλ λ¨μ§ 2λ°μ΄νΈμ λ©λͺ¨λ¦¬λ§ νμνλ©° μ ν μ μΈ λ¬Έμλ "%"μ λλ€.
Dim Variable%
Dim Variable As Integer
Long Integer λ³μλ -2147483648μμ 2147483647κΉμ§μ λ²μλ₯Ό κ°μ§λλ€. Long Integer λ³μμ λΆλ μμμ κ°μ ν λΉν κ²½μ° μμμ μ΄ν μλ¦Ώμκ° λ€μ μ μλ‘ λ°μ¬λ¦Όλ©λλ€. Long Integer λ³μλ νλ‘μμ μμ μ μνκ² κ³μ°λκΈ° λλ¬Έμ ν° κ°μ λν 루νμ μΉ΄μ΄ν° λ³μμ μ ν©ν©λλ€. Long Integer λ³μμλ 4λ°μ΄νΈμ λ©λͺ¨λ¦¬κ° νμνλ©° μ ν μ μΈ λ¬Έμλ "&"μ λλ€.
Dim Variable&
Dim Variable As Long
decimal λ³μλ μμ, μμ λλ 0 κ°μ μ·¨ν μ μμ΅λλ€. μμμ μ΄ν μλ¦Ώμλ μ΅λ 29κ°λ‘ μ νλ©λλ€.
μμ μμ λνκΈ°(+) λλ λΉΌκΈ°(-) κΈ°νΈλ₯Ό μ¬μ©ν μ μμ΅λλ€(곡백 μ 무 κ΄κ³ μμ).
integer λ³μμ μμκ° ν λΉλλ©΄ Collabora Office Basicμ΄ μ«μλ₯Ό μ¬λ¦Ό λλ λ²λ¦Όν©λλ€.
Single variables can take positive or negative values ranging from 3.402823 x 10E38 to 1.401298 x 10E-45. Single variables are floating-point variables, in which the decimal precision decreases as the non-decimal part of the number increases. Single variables are suitable for mathematical calculations of average precision. Calculations require more time than for Integer variables, but are faster than calculations with Double variables. A Single variable requires 4 bytes of memory. The type-declaration character is "!".
Dim Variable!
Dim Variable As Single
Double variables can take positive or negative values ranging from 1.79769313486232 x 10E308 to 4.94065645841247 x 10E-324. Double variables are floating-point variables, in which the decimal precision decreases as the non-decimal part of the number increases. Double variables are suitable for precise calculations. Calculations require more time than for Single variables. A Double variable requires 8 bytes of memory. The type-declaration character is "#".
Dim Variable#
Dim Variable As Double
Currency λ³μλ λ΄λΆμ μΌλ‘ 64λΉνΈ μ«μ(8λ°μ΄νΈ)λ‘ μ μ₯λλ©° μμμ μ μλ¦Ώμκ° 15μ리μ΄κ³ μμμ μ΄ν μλ¦Ώμκ° 4μλ¦¬μΈ κ³ μ μμμ μ«μλ‘ νμλ©λλ€. κ° λ²μλ -922337203685477.5808μμ +922337203685477.5807κΉμ§μ λλ€. Currency λ³μλ μ νλκ° λμ ν΅ν κ° κ³μ°μ μ¬μ©λλ©° μ ν μ μΈ λ¬Έμλ "@"μ λλ€.
Dim Variable@
Dim Variable As Currency
Numbers can be encoded using octal and hexadecimal forms.
xi = &o13 ' 8 + 3
ci = &h65 ' 6*16 + 5
MAX_Integer = &o77777 ' 32767 = &h7FFF
MIN_Integer = &o100000 ' -32768 = &h8000
MAX_Long = &h7fffffff ' 2147483647 = &o17777777777
MIN_Long = &h80000000 ' -2147483648 = &o20000000000
String variables can hold character strings with up to 2,147,483,648 characters. Each character is stored as the corresponding Unicode value. String variables are suitable for word processing within programs and for temporary storage of any non-printable character up to a maximum length of 2 Gbytes. The memory required for storing string variables depends on the number of characters in the variable. The type-declaration character is "$".
In BASIC String functions, the first character of the string has index 1.
Dim Variable$
Dim Variable As String
Boolean λ³μλ TRUE κ° λλ FALSE κ° μ€ νλλ§ μ μ₯ν©λλ€. μ«μ 0μ FALSE, λ€λ₯Έ λͺ¨λ κ°μ TRUEλ‘ νκ°λ©λλ€.
Dim Variable As Boolean
Date λ³μλ λ΄λΆ μμμΌλ‘ μ μ₯λ λ μ§ λ° μκ° κ°λ§ ν¬ν¨ν μ μμ΅λλ€. Dateserial, Datevalue, Timeserial λλ Timevalueλ₯Ό μ¬μ©νμ¬ Date λ³μμ ν λΉλ κ°μ μλμΌλ‘ λ΄λΆ μμμΌλ‘ λ³νλ©λλ€. Date λ³μλ Day, Month, Year λλ Hour, Minute, Second ν¨μλ₯Ό μ¬μ©νμ¬ μΌλ° μ«μλ‘ λ³νλ©λλ€. λ΄λΆ μμμ λ μ«μμ μ°¨λ₯Ό κ³μ°νμ¬ λ μ§/μκ° κ°μ λΉκ΅ν μ μκ² ν©λλ€. Date λ³μλ ν€μλ Dateλ‘λ§ μ μΈν μ μμ΅λλ€.
Dim Variable As Date
Date literals allow to specify unambiguous date variables that are independent from the current language. Literals are enclosed between hash signs #. Possible formats are:
#yyyy-mm-dd#
#mm/dd/yyyy#
start_date = #12/30/1899# ' = 1
dob = #2010-09-28#
Variables declared as Variant can handle any data type. This means that the actual data type is defined during runtime as a value is assigned to the variable.
There are three main ways to create a Variant variable, as shown below:
Dim varA ' The type is not specified, hence the variable is a Variant
Dim varB as Variant ' The variable is explicitly declared as a Variant
varC = "abc" ' Previously undeclared variables are treated as Variants
The example below uses the TypeName function to show how the type of a Variant variable changes upon assignment.
Dim myVar As Variant
MsgBox TypeName(myVar) ' Empty
myVar = "Hello!"
MsgBox TypeName(myVar) ' String
myVar = 10
MsgBox TypeName(myVar) ' Integer
A Variant variable is initialized with the Empty special data type. You can use the IsEmpty function to test if a variable is an Empty Variant.
You can also use the keyword Any to declare a variable as a Variant. However, Any is deprecated and is available for backward compatibility.
Arguments with type Variant or Any passed in function calls are not checked for their types.
Dim myVar As Any ' Variable "myVar" is a Variant
μ΄ λ³μλ μ μΈλμλ§μ "Null" κ°μΌλ‘ μλ μ€μ λ©λλ€. λ€μ κ·μΉμ μ£Όμν©λλ€.
Numeric λ³μλ μ μΈλμλ§μ κ° "0"μ΄ μλμΌλ‘ ν λΉλ©λλ€.
Date λ³μμλ κ° 0μ΄ λ΄λΆμ μΌλ‘ ν λΉλ©λλ€. μ΄κ²μ Day, Month, Year λλ Hour, Minute, Second ν¨μλ₯Ό μ¬μ©νμ¬ κ°μ "0"μΌλ‘ λ³ννλ κ²κ³Ό κ°μ΅λλ€.
String λ³μλ μ μΈλ λ λΉ λ¬Έμμ΄("")μ΄ ν λΉλ©λλ€.
Collabora Office Basicμ μ§μ ν λ³μ μ νμ μν΄ μ§μ λλ μΌμ°¨μ λλ λ€μ°¨μ λ°°μ΄μ μΈμν©λλ€. λ°°μ΄μ νλ‘κ·Έλ¨μμ λͺ©λ‘κ³Ό ν μ΄λΈμ νΈμ§νλ λ° μ ν©ν©λλ€. λ°°μ΄μ κ°λ³ μμλ μ«μ μμΈμ ν΅ν΄ μ§μ ν μ μμ΅λλ€.
λ°°μ΄μ λ°λμ Dim λ¬Έμ μ¬μ©νμ¬ μ μΈν΄μΌ ν©λλ€. λ€μμ λ°°μ΄μ μμΈ λ²μλ₯Ό μ§μ νλ λͺ κ°μ§ λ°©λ²μ λλ€.
Dim Text$(20) '21 elements numbered from 0 to 20'
Dim Text$(5,4) '30 elements (a matrix of 6 x 5 elements)'
Dim Text$(5 To 25) '21 elements numbered from 5 to 25'
Dim Text$(-15 To 5) '21 elements (including 0), numbered from -15 to 5'
μμΈ λ²μλ μμμ μμλ₯Ό λͺ¨λ ν¬ν¨ν μ μμ΅λλ€.
μμλ κ³ μ κ°μ κ°μ§λλ€. μμλ λ€μκ³Ό κ°μ΄ νλ‘κ·Έλ¨μμ ν λ²λ§ μ§μ λλ©° λμ€μ λ€μ μ§μ ν μ μμ΅λλ€.
Const ConstName=Expression