Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Libraries in Excel
I am trying to bystep making each user go to Tools-References on the toolbar
in the visual basic editor, to check the box to include the ADO 2.8 Library. Using early and/or late binding seems to do nothing as far as "checking the box" for the user. Is there coding, since you cannot do macros for this, to include the library? Like in C++ you would use the statement #include to add a library, what do you have to do for either VBA or ADO?? Thank you. Brent |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Libraries in Excel
If you "check the box" and save the file and another user opens the file,
the box will still be checked. The only problem that can occur is if the referenced library does not exist on the other user's machine. In that case an untrappable error will occur. If that's a possibility use late binding. Late binding does not literally "check the box" but it doesn't have to. It does establish the reference in code. -- Jim "Brent" wrote in message ... |I am trying to bystep making each user go to Tools-References on the toolbar | in the visual basic editor, to check the box to include the ADO 2.8 Library. | Using early and/or late binding seems to do nothing as far as "checking the | box" for the user. Is there coding, since you cannot do macros for this, to | include the library? Like in C++ you would use the statement #include to add | a library, what do you have to do for either VBA or ADO?? Thank you. | | Brent |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Libraries in Excel
maybe this will give you some idea... this is for Excel 2003. Create a new
workbook and paste the code in the Thisworkbook code module. Save it and then open the workbook. It would add a reference to ADO Library 2.8 on open. One caveat to this is that you must permit access to the Visual Basic Project. Tools-Macro-Security, in the Trusted Publishers tab, check "Trust Access to Visual Basic Project". Option Explicit Private Sub Workbook_Open() If Not IsADOReferenced Then ThisWorkbook.VBProject.References.AddFromGuid "{2A75196C-D9EB-4129-B803-931327F72D5C}", 2, 8 End If Test_ADO End Sub Private Function IsADOReferenced() As Boolean Dim strGUID As String Dim r As Object strGUID = "{2A75196C-D9EB-4129-B803-931327F72D5C}" IsADOReferenced = False For Each r In ThisWorkbook.VBProject.References If r.GUID = strGUID Then IsADOReferenced = True Exit For End If Next r End Function Private Sub Test_ADO() Dim conn As New ADODB.Connection MsgBox conn.Version End Sub -- Hope that helps. Vergel Adriano "Brent" wrote: I am trying to bystep making each user go to Tools-References on the toolbar in the visual basic editor, to check the box to include the ADO 2.8 Library. Using early and/or late binding seems to do nothing as far as "checking the box" for the user. Is there coding, since you cannot do macros for this, to include the library? Like in C++ you would use the statement #include to add a library, what do you have to do for either VBA or ADO?? Thank you. Brent |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Libraries in Excel
r.GUID produces an error. If I do late binding this line produces an error:
rs.Open "table1", cn, adOpenKeyset, adLockOptimistic, adCmdTable if I take out evrything after cn then I get an error at rs.AddNew. Any suggestions?? Thank you!! Brent "Vergel Adriano" wrote: maybe this will give you some idea... this is for Excel 2003. Create a new workbook and paste the code in the Thisworkbook code module. Save it and then open the workbook. It would add a reference to ADO Library 2.8 on open. One caveat to this is that you must permit access to the Visual Basic Project. Tools-Macro-Security, in the Trusted Publishers tab, check "Trust Access to Visual Basic Project". Option Explicit Private Sub Workbook_Open() If Not IsADOReferenced Then ThisWorkbook.VBProject.References.AddFromGuid "{2A75196C-D9EB-4129-B803-931327F72D5C}", 2, 8 End If Test_ADO End Sub Private Function IsADOReferenced() As Boolean Dim strGUID As String Dim r As Object strGUID = "{2A75196C-D9EB-4129-B803-931327F72D5C}" IsADOReferenced = False For Each r In ThisWorkbook.VBProject.References If r.GUID = strGUID Then IsADOReferenced = True Exit For End If Next r End Function Private Sub Test_ADO() Dim conn As New ADODB.Connection MsgBox conn.Version End Sub -- Hope that helps. Vergel Adriano "Brent" wrote: I am trying to bystep making each user go to Tools-References on the toolbar in the visual basic editor, to check the box to include the ADO 2.8 Library. Using early and/or late binding seems to do nothing as far as "checking the box" for the user. Is there coding, since you cannot do macros for this, to include the library? Like in C++ you would use the statement #include to add a library, what do you have to do for either VBA or ADO?? Thank you. Brent |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Libraries in Excel
just did late binding and change adOpenKeyset, adLockOptimistic, adCmdTable
to 1,3,&H2 and it works now. Thank you all. "Brent" wrote: r.GUID produces an error. If I do late binding this line produces an error: rs.Open "table1", cn, adOpenKeyset, adLockOptimistic, adCmdTable if I take out evrything after cn then I get an error at rs.AddNew. Any suggestions?? Thank you!! Brent "Vergel Adriano" wrote: maybe this will give you some idea... this is for Excel 2003. Create a new workbook and paste the code in the Thisworkbook code module. Save it and then open the workbook. It would add a reference to ADO Library 2.8 on open. One caveat to this is that you must permit access to the Visual Basic Project. Tools-Macro-Security, in the Trusted Publishers tab, check "Trust Access to Visual Basic Project". Option Explicit Private Sub Workbook_Open() If Not IsADOReferenced Then ThisWorkbook.VBProject.References.AddFromGuid "{2A75196C-D9EB-4129-B803-931327F72D5C}", 2, 8 End If Test_ADO End Sub Private Function IsADOReferenced() As Boolean Dim strGUID As String Dim r As Object strGUID = "{2A75196C-D9EB-4129-B803-931327F72D5C}" IsADOReferenced = False For Each r In ThisWorkbook.VBProject.References If r.GUID = strGUID Then IsADOReferenced = True Exit For End If Next r End Function Private Sub Test_ADO() Dim conn As New ADODB.Connection MsgBox conn.Version End Sub -- Hope that helps. Vergel Adriano "Brent" wrote: I am trying to bystep making each user go to Tools-References on the toolbar in the visual basic editor, to check the box to include the ADO 2.8 Library. Using early and/or late binding seems to do nothing as far as "checking the box" for the user. Is there coding, since you cannot do macros for this, to include the library? Like in C++ you would use the statement #include to add a library, what do you have to do for either VBA or ADO?? Thank you. Brent |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Libraries in Excel
"Brent" wrote: I am trying to bystep making each user go to Tools-References on the toolbar in the visual basic editor, to check the box to include the ADO 2.8 Library. Using early and/or late binding seems to do nothing as far as "checking the box" for the user. Is there coding, since you cannot do macros for this, to include the library? Like in C++ you would use the statement #include to add a library, what do you have to do for either VBA or ADO?? Thank you. Brent |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
PHP Excel generation libraries | Excel Programming | |||
Cannot open Excel, message given is about VBA libraries? | Excel Discussion (Misc queries) | |||
How to identify missing libraries in Excel (Office-XP) using VBA | Excel Programming | |||
Newbie: Libraries for Excel? | Excel Programming | |||
Libraries In Excel VB Editor | Excel Programming |