Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need Help using/calling a DLL
Sorry if this appears twice but my first attempt didn't seem to make
its way into the new-group... Hello all, I could use some help here... I have a dll called LindAccessComponent.dll which is registered with Windows and included as a reference under Tools - References. I'm copying the code from VB6 to VBA but can't get it to work. In VB6 FormMain loads and does this in Form_Load()... Set iConnect = New LIND_ACCESS_COMPONENTLib.LindAccess Set iLeg = iConnect Set iOrder = iConnect Set iCheck = iConnect and in the form's declaration section there is this... Public WithEvents iConnect As LIND_ACCESS_COMPONENTLib.LindAccess Dim iOrder As LIND_ACCESS_COMPONENTLib.iOrder Dim iLeg As LIND_ACCESS_COMPONENTLib.iLeg Dim iCheck As LIND_ACCESS_COMPONENTLib.iCheck and as a result any procedure within the form that uses iConnect, etc. knows what iConnect is. In Excel VBA I have done this... In Sheet2's declaration section I have.... Public WithEvents iConnect As LIND_ACCESS_COMPONENTLib.LindAccess Public iOrder As LIND_ACCESS_COMPONENTLib.iOrder Public iLeg As LIND_ACCESS_COMPONENTLib.iLeg Public iCheck As LIND_ACCESS_COMPONENTLib.iCheck In ThisWorkbook I call a sub from Workbook_Open() that does... Set iConnect = New LIND_ACCESS_COMPONENTLib.LindAccess Set iLeg = iConnect Set iOrder = iConnect Set iCheck = iConnect BUT... whenever I try to use iConnect.anything I get an "Object Required" error. What am I doing wrong?? If I put Set iConnect = New LIND_ACCESS_COMPONENTLib.LindAccess in each proceudre it works - but I'm pretty sure that this is not the right way to do it. Any direction would be greatly appreciated! Thanks! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need Help using/calling a DLL
In Sheet2's declaration section I have....
Public WithEvents iConnect As LIND_ACCESS_COMPONENTLib.LindAccess Public iOrder As LIND_ACCESS_COMPONENTLib.iOrder Public iLeg As LIND_ACCESS_COMPONENTLib.iLeg Public iCheck As LIND_ACCESS_COMPONENTLib.iCheck Just a guess but I think the above belongs in a class module (on the Insert menu). -- Jim "Trip" wrote in message oups.com... | Sorry if this appears twice but my first attempt didn't seem to make | its way into the new-group... | | Hello all, | | I could use some help here... | | I have a dll called LindAccessComponent.dll which is registered with | Windows and included as a reference under Tools - References. | | I'm copying the code from VB6 to VBA but can't get it to work. | | In VB6 FormMain loads and does this in Form_Load()... | Set iConnect = New LIND_ACCESS_COMPONENTLib.LindAccess | Set iLeg = iConnect | Set iOrder = iConnect | Set iCheck = iConnect | | and in the form's declaration section there is this... | Public WithEvents iConnect As LIND_ACCESS_COMPONENTLib.LindAccess | Dim iOrder As LIND_ACCESS_COMPONENTLib.iOrder | Dim iLeg As LIND_ACCESS_COMPONENTLib.iLeg | Dim iCheck As LIND_ACCESS_COMPONENTLib.iCheck | | and as a result any procedure within the form that uses iConnect, etc. | knows what iConnect is. | | In Excel VBA I have done this... | In Sheet2's declaration section I have.... | Public WithEvents iConnect As LIND_ACCESS_COMPONENTLib.LindAccess | Public iOrder As LIND_ACCESS_COMPONENTLib.iOrder | Public iLeg As LIND_ACCESS_COMPONENTLib.iLeg | Public iCheck As LIND_ACCESS_COMPONENTLib.iCheck | | In ThisWorkbook I call a sub from Workbook_Open() that does... | Set iConnect = New LIND_ACCESS_COMPONENTLib.LindAccess | Set iLeg = iConnect | Set iOrder = iConnect | Set iCheck = iConnect | | BUT... whenever I try to use iConnect.anything I get an "Object | Required" error. What am I doing wrong?? If I put Set iConnect = New | LIND_ACCESS_COMPONENTLib.LindAccess in each proceudre it works - but | I'm pretty sure that this is not the right way to do it. | | Any direction would be greatly appreciated! | | Thanks! | |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Calling an Add-In | Excel Discussion (Misc queries) | |||
Calling DOS commands in VBA | Excel Programming | |||
Calling a VB.NET exe/dll from excel | Excel Programming | |||
Calling Excel from C++ | Excel Programming | |||
Calling SUB | Excel Programming |