Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default 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
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
PHP Excel generation libraries sikander iqbal Excel Programming 3 January 22nd 07 03:53 AM
Cannot open Excel, message given is about VBA libraries? Kolbie Stuck Excel Discussion (Misc queries) 1 October 27th 05 07:00 PM
How to identify missing libraries in Excel (Office-XP) using VBA Helge V. Larsen[_3_] Excel Programming 2 April 21st 05 02:07 PM
Newbie: Libraries for Excel? Rich[_16_] Excel Programming 1 December 1st 03 05:49 AM
Libraries In Excel VB Editor ccdubs Excel Programming 1 July 28th 03 12:31 AM


All times are GMT +1. The time now is 01:32 AM.

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"