And in Openoffice ???. This is very important for advanced programming.
Thank you

Code: Select all
Option VBASupport 1
Sub Main
Dim test As Collection
Set test = New Collection
test.Add("foo", "1")
msgbox test(1)
End Sub
This is not specific to OOo 3, you don't need VBASupport.tani wrote:I tried just now on WindowsXP + OOo3(Basic).
If "VBASupport" to enable, "Collection" objects can be used.
Code: Select all
Dim test As New Collection
test.Add("foo", "1")
msgbox test(1)
' calling an object from MS-Windows follows the same syntax
Dim fso As New Scripting.FileSystemObject
MsgBox("Number of drives : " & fso.Drives.Count)
Edit: see my next message in this thread. ______ Bernard |
Code: Select all
Sub DictionaryExample
Dim k As String
Dim dico As New Collection
dico.Add("49000", "Angers") ' key = "Angers", Item = "49000"
dico.Add("33000", "Bordeaux")
dico.Add("09000", "Foix")
dico.Add("11350", "Cucugnan")
MsgBox("Number of elements : " & dico.Count)
Do
k = InputBox("Town : ", "Find postal code", "")
if Len(k) = 0 then Exit Do
On Error GoTo inconnu
MsgBox("Postal code : " & dico(k) ) ' the key is not case sensitive
suite1:
On Error GoTo 0
Loop
Exit Sub
inconnu:
MsgBox("Town " & k & " is unknown", 16)
Resume Suite1
End Sub