Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Need Help using/calling a Reference

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!

Trip

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Need Help using/calling a Reference

Hi Trip

I am not sure but Sheet2 is a ClassModule. If you insert a regular module
and paste your declarations there, it might work.

Michael

"Trip" wrote:

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!

Trip


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Need Help using/calling a Reference

I thought Rob Bovey had helped solve this for you?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Trip" wrote in message
oups.com...
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!

Trip



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help using/calling a Reference Trip[_3_] Excel Programming 0 January 9th 06 03:23 AM
Calling an Add-In BillCPA Excel Discussion (Misc queries) 2 August 11th 05 09:32 PM
Reference code in another workbook from a calling workbook Datasort Excel Programming 1 January 4th 05 01:13 AM
Calling SUB Peter Longstaff Excel Programming 2 February 23rd 04 08:04 PM
Calling sub programs ChuckM[_2_] Excel Programming 2 December 16th 03 05:52 PM


All times are GMT +1. The time now is 11:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"