PeterBunde
New Member
- Joined
- Dec 7, 2016
- Messages
- 45
Fellow sufferers
Please see my (partly pseudo-) code below. I first build a tree structure and would then like to pick one branch of it and send it to a subroutine for processing. Believe the code explains what I wish to do.
BW Peter Bunde Hansen
Please see my (partly pseudo-) code below. I first build a tree structure and would then like to pick one branch of it and send it to a subroutine for processing. Believe the code explains what I wish to do.
BW Peter Bunde Hansen
Code:
Sub Test()
Dim inhabitants_in As Object
Dim x As Variant
Dim y As Variant
Set inhabitants_in = CreateObject("Scripting.Dictionary")
' add countries
inhabitants_in.Add "Norway", CreateObject("Scripting.Dictionary")
inhabitants_in.Add "France", CreateObject("Scripting.Dictionary")
inhabitants_in.Add "Italy", CreateObject("Scripting.Dictionary")
' add cities and number of inhabitants
inhabitants_in("Norway").Add "Oslo", 500000
inhabitants_in("Norway").Add "Bergen", 300000
inhabitants_in("France").Add "Paris", 1000000
For Each country In inhabitants_in
Call country_manager(country)
Next country
End Sub
Private Function country_manager(cities_population() As Integer)
For Each city In cities_population
MsgBox ("Poopulation of: " & CStr(city) & " is: " & city_population(city))
Next country
End Function