So CreateObject usually takes a ProgId which is a human language string which is then looked up in the registry. However, sometimes the ProgId is not available, only a clsid is available. In such cases, it is still possible to instantiate the class using CreateObject one uses the syntax below.
Option Explicit
Sub Test()
Dim dic As Object
'Set dic = CreateObject("Scripting.Dictionary")
Set dic = CreateObject("new:{EE09B103-97E0-11CF-978F-00A02463E06F}")
dic.Add "blue", 5
dic.Add "red", 7
dic.Add "green", 11
Debug.Assert dic.Count = 3
End Sub
No comments:
Post a Comment