Missing References for VBA

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • OlgaMir
    New Member
    • Oct 2011
    • 1

    Missing References for VBA

    Hi there!
    This code doesn't work for me. Why? I have Access 2003.

    Code:
    Dim VBAEditor As VBIDE.VBE
    Dim VBProj As VBIDE.VBProject
    Dim chkRef As VBIDE.Reference
    
    Set VBAEditor = Application.VBE
    Set VBProj = VBAEditor.ActiveVBProject
    For Each chkRef In VBProj.References
      If chkRef.IsBroken Then
        VBProj.References.Remove chkRef // Gives me an error
      End If
    Next
    The error is "Object library not registered"
    Which library?
    I tried to registry all of them, some of them was fine.
    But when I tried:
    Regsvr32 "C:\Program Files (x86)\Microsoft Office\OFFICE11 \MSACC.OLB"
    - it gives me an error: The module "C:\Program Files (x86)\Microsoft Office\OFFICE11 \MSACC.OLB" was loaded but the entry-point DllRegisterServ er was not found.

    Thanks for your help!
    Last edited by NeoPa; Oct 27 '11, 12:49 AM. Reason: Added mandatory [CODE] tags for you
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32662

    #2
    You need the reference :
    Microsoft Visual Basic for Applications Extensibility 5.3
    to be selected within Tools / References.

    Comment

    • ADezii
      Recognized Expert Expert
      • Apr 2006
      • 8834

      #3
      No External References needed
      Code:
      Dim ref As Reference
      
      For Each ref In Application.References
        If ref.IsBroken Then Application.References.Remove ref
      Next

      Comment

      Working...