Things under legendu
Things on this page are fragmentary and immature notes/thoughts of the author. It is not meant to readers but rather for convenient reference of the author and future improvement.
Dictionary/Hashtable¶
Set a reference to MS Scripting runtime
Set dict = CreateObject("Scripting.Dictionary")
or
Dim dict As New Scripting.Dictionary Example of use:
If Not dict.Exists(key) Then dict.Add key, value End IfDon’t forget to set the dictionary to Nothing when you have finished using it.
Set dict = Nothing
Your Own Data Structure¶
You can define your own type in VBA.
Dim numbers = New Integer() {1, 2, 4, 8}
Dim doubles = {1.5, 2, 9.9, 18}
Dim myarray As Variant
myarray = Array("Cat", "Dog", "Rabbit")