General discussion

Locked

Programmatically reference an ActiveX dll

By SanKulPune ·
I have been searching for the solution but without success.

Can I programatically make a reference to an ActiveX dll as an alternative to manually doing

Project > reference.

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Erm from what ?

by Tony Hopkinson In reply to Programmatically referenc ...

????

.net ?

Collapse -

Re. Erm from what

by SanKulPune In reply to Erm from what ?
Collapse -

createobject

by Slayer_ In reply to Re. Erm from what

<strong>set oObj = CreateObject("Class.object")</strong>


Example
<strong>
Dim oXML as Object
Set oXML = CreateObject("Microsoft.XMLDOM")</strong>

Creates a DOM object.


When you are done using the object, set its reference to nothing


<strong>Set oXML = Nothing</strong>

This will free up the memory


Also, watch yourself on objects. An created object is considered "empty". If you set an object to nothing, it is not empty, but it IS nothing.

Put simply, this code will runtime error if your object was not created.

<strong>If Not Is Nothing Then</strong> 'Check if object has not been created

So a trick I have learned when dealing with objects in VB6 and especially VBScript, is to actually set all your object variables to "nothing" before you even use them. That way they are always non "empty".

Back to Windows Forum
3 total posts (Page 1 of 1)  

Related Forums