I have a function that is appending a dictionary. I want to keep the contents of this dictionary as long as the updateList isn't true. I currently have it setup like this:
Public Function runPolluxFull(voerUit As Boolean, updateList As Boolean)
Dim dicTitle As Variable
Dim dicFound As Variable
If updateList = True Then
Set dicTitle = CreateObject("Scripting.Dictionary")
Set dicFound = CreateObject("Scripting.Dictionary")
While status
Set ObjectsJSON = jsonlibPollux.parse(responseString)
With dicTitle
.Add inc, ObjectsJSON.Item("title")
End With
With dicFound
.Add inc, ObjectsJSON.Item("description")
End With
Wend
End If
And when voerUit is true the following happens:
For i = 1 To dicTitle.Count
klaar = findReplace(dicTitle.Item(i), "x" + dicTitle.Item(i), dicTitle.Item(i) + vbCrLf + vbCrLf + dicFound.Item(i))
Next i
The problem here is that when this function ends, dicTitle and dicFound are cleared, and the findReplace function gets fed empty arguments.
Is there anyway to makes to code work, or a good workaround?