Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub AddADO()
Dim R For Each R In ThisWorkbook.VBProject.References If R.GUID = "{00000205-0000-0010-8000-00AA006D2EA4}" And R.Major = 2 Then Exit Sub End If Next On Error GoTo NOTFOUND 'although usually the ADO version will be higher, doing Minor:=0 will install 'the higher version if available. On the other hand when you specify Minor:=5 'and only a lower version is available, this can't be installed '---------------------------------------------------------------------------- ThisWorkbook.VBProject.References.AddFromGuid _ GUID:="{00000205-0000-0010-8000-00AA006D2EA4}", _ Major:=2, Minor:=0 Exit Sub NOTFOUND: On Error GoTo 0 End Sub RBS "Fred" <leavemealone@home wrote in message ... I create a new workbook simply by copying a worksheet, i.e. ActiveSheet.copy. The problen is that the sheet has subroutines that require the ADODB and so the new workbook needs to reference the Microsoft ActiveX Data Objects Library. I know I can add that reference to the new workbook using Tools:References from the main menu but how can I add that reference to the new workbook programmatically. Thanks for any help, Fred |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Adding VB code to worksheet programatically | Excel Programming | |||
Adding a Control programatically | Excel Programming | |||
default references or adding programatically | Excel Programming | |||
Programatically adding worksheets to a spreadsheet | Excel Programming | |||
Adding components to multipage programatically | Excel Programming |