Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

VBE Missing References in Excel 2003

  Asked By: Sunil    Date: Oct 25    Category: MS Office    Views: 1049
  

I'm developing in Excel 2007 and when opening the file in Excel 2003, I
get the following missing references in the VBE:

MISSING: Microsoft Outlook 12.0 Object Library
MISSING: Microsoft PowerPoint 12.0 Object Library

Does anybody know how to automatically remove missing references in both
Excel 2007 and 2003 and add necessary references such as:

Microsoft Outlook 11.0 Object Library
Microsoft PowerPoint 11.0 Object Library

I found the following code, which I referenced from Workbook_Open, but
it froze my Excel and I'm not sure where to go from here?
www.vbaexpress.com/kb/getarticle.php?kb_id=272

Option Explicit

Sub References_RemoveMissing()
'Macro purpose: To remove missing references from the VBE

Dim theRef As Variant, i As Long

On Error Resume Next

For i = ThisWorkbook.VBProject.References.Count To 1 Step -1
Set theRef = ThisWorkbook.VBProject.References.Item(i)
If theRef.isbroken = True Then
ThisWorkbook.VBProject.References.Remove theRef
End If
Next i

If Err <> 0 Then
MsgBox "A missing reference has been encountered!" _
& "You will need to remove the reference manually.", _
vbCritical, "Unable To Remove Missing Reference"
End If

On Error Goto 0
End Sub

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on VBE Missing References in Excel 2003 Or get search suggestion and latest updates.




Tagged: