Important: Both methods will work only if the DLL exposes a COM interface.
If your dll is registered with the system, use CreateObject
with it's ProgID.
Set myObject = CreateObject("MyReallyCoolObject.HelloWorld")
myObject.Print
If your object is not registered on the system, use GetObject
with a path to the file containing your object. Make sure your object exposes the proper interface. (The second parameter is optional. Here you can provide a class name if your object exposes more than one.)
Set myObject = GetObject("C:somepathhelloworld.dll", "appname.HelloWorld")
myObject.Print
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…