Re: How to get an ADO control in my Excel 2002?



I ran this sub, it gave me this message:
run time error '1004'
Method 'VBProject' of object '_workbook' failed

What does it mean?

Thanks



"RB Smissaert" wrote:

> I don't think there is an ADO control but you will need a reference to the
> Microsoft ActiveX Data Objects Library and this code will set the reference
> to that library:
>
> 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
>
>
> Once you have this reference you can set your connection and work with the
> database.
> Plenty of examples on the net how to do this.
>
>
> RBS
>
>
> "NiceGuy" <NiceGuy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:D66FF1C1-93E1-4662-8AF5-54EB19D57D07@xxxxxxxxxxxxxxxx
> > I'm developing a small program using Excel 2002 and VBA with a connection
> > to
> > Access. However there is no ADO control in my excel. Where do I get one
> > and
> > how to register it?
>
>
.



Relevant Pages

  • Entry.cs // A common EntryPoint for a project.
    ... /// Main Entry Point. ... Public Sub New ... excel workbook, sheet. ... microsoft Excel object lib 9, 10, 11, etc via the Project Add Reference ...
    (microsoft.public.dotnet.languages.csharp)
  • RXParse module v.91 (by robic0)
    ... # Unicode character reference ... sub original_content ... then call content handler with $content ...
    (comp.lang.perl.misc)
  • Re: Emailing a Report
    ... make sure you have a reference to a Microsoft DAO Library ... The Sub LoopAgmtsSendEmail is highlighted by the Debugger. ... 'pSQL -- defines the recordset to open ... You must remember to enclose literal values in quotes and concatenate them; the final string must have commas too, ...
    (microsoft.public.access.modulesdaovba)
  • Re: Please help me clarify these byVal vs. byRef subtleties
    ... ByVal & ByRef Parameters are independent of Reference & Value Types. ... > I've got a class, DataHider, with one private string field (i.e., ... > Public Sub callObjectMethodPassedByVal(ByVal myObj As ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Shared Method Problem With "Global" Storage
    ... a routine in Module1 which then calls code back in Form1 ... ButtonHasBeenClicked but the reference to ButtonHasBeenClicked ... instance member of a class from within a shared method or shared ... In a shared Sub, you can not access an instance field withouth ...
    (microsoft.public.dotnet.languages.vb)