We help IT Professionals succeed at work.

reference a file in VB6 in Code

Instead of simply adding a Reference to my project via Project->References how can i load that file at runtime only if the user requires it? My problem is I have a reference that needs to be included for only some people, but not everyone is going to have that file installed/registered on their machine. So i only want to call it for the users that are utilizing it's functionality.

Thanks,
Comment
Watch Question

Commented:
You can use createobject
example
                Dim ObjExcel As Object
                Set ObjExcel = CreateObject("Excel.Application")

This is called late binding.
Feel free to ask additional info on this.

Author

Commented:
Thanks,

When I try to use the following i get a Run-Time error 429 error stating: ActiveX component cant create object.

Set objResult = CreateObject("Link.ShowPageResult")

when i do the following right before it everything works fine:
Set objPayLink = CreateObject("Link.Page")

both the "Page" and "ShowPageResult" are classes and members of "Link"

Author

Commented:
Please disregard last question as i had a typo.
GrahamSkanRetired
Top Expert 2012

Commented:
Whether it is early or late binding, any code that tries to use the particular object will fail if the file is not present.

Author

Commented:
Worked perfect!