Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "hbj" wrote in message Keep in mind if your file is ever loaded on a system without the 2.8 it will fail again. Late Binding would usually avoid these problems. "Late Binding/Early Binding. I'm sorry not understanding those methods." The reference to the library in Tools/References "early" binds the the library. It loads faster and gives all the intelisense and named constants, useful while developing. Problems can occur when distributing the project if the version of referenced object library is different. Hence develop with the reference, distribute without the reference. Without the reference all object references should be declared 'As Object', and any named constants should be replaced with their intinsic values. The project can include code that handles both methods, eg In Project Properties, Conditional Compilation Arguments, LateB = 0 #If LateB Then ' include ADODB constants used in the project Public Const adLockReadOnly As Long = 1 #End If Sub test() #If LateB Then Dim rsCon As Object Dim rsData As Object #Else Dim rsCon As ADODB.Connection Dim rsData As ADODB.Recordset #End If ' code #If LateB Then Set rsCon = CreateObject("ADODB.Connection") Set rsData = CreateObject("ADODB.Recordset") #Else Set rsCon = New ADODB.Connection Set rsData = New ADODB.Recordset #End If ' code End Sub Adapt the code as above for object variables and include any named constants also as above. Head all modules Option Explicit and do Debug/Compile, test the code Then test as Late Binding: change the conditional constant to LateB = 1, remove the ADO reference in tools/refs, again do Debug/Compile, test the code. In theory Early Binding is much faster, but in practice typically won't notice any difference with Late Binding Peter T |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA - Cannot find project or library | Excel Programming | |||
Can't find project of library | Excel Discussion (Misc queries) | |||
Can't find project or library | Excel Worksheet Functions | |||
Can't find project or library | Excel Programming | |||
Can't find project or library | Excel Programming |