Eenvoudig dictionary voorbeeld

Sub Dictionary_Example()
    'Create variable
    Dim odict As Object
    Dim varKey As Variant

    'Set a reference to the Scripting.Dictionary
    Set odict = CreateObject("Scripting.Dictionary")

    'Add some keys (here, countries) and items (here, capitals)
    odict.Add "Netherlands", "Amsterdam"
    odict.Add "Germany", "Berlin"
    odict.Add "Spain", "Madrid"
    odict.Add "Norway", "Oslo"
    odict.Add "Swizerland", "Bern"
    odict.Add "France", "Paris"
    odict.Add "Bosnia and Herzegovina", "Sarajevo"
    odict.Add "Czech Republic", "Prague"
    odict.Add "Slovakia", "Bratislava"
    
    'Loop through oDict and display the info
    For Each varKey In odict.Keys()
    
        'Print to the immediate window
        Debug.Print odict(varKey)
    Next
End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *