Consulting

Results 1 to 11 of 11

Thread: Find Missing VBA Project References Code

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Regular
    Joined
    Dec 2013
    Posts
    11
    Location

    Find Missing VBA Project References Code

    Workbook developed in Excel 11. Has worked great everywhere, literally globally, until I ran into Win8 with Office 2013.

    What I need is code that will display in a message box, the library references that are missing when the workbook is opened on the W8 Off2013 box.

    I have code from a solution I found on this board that did not work. I would live to link to that but the system WILL NOT LET ME.

    The solution was a workbook [book1] that you ran on your system, then sent to the user with the higher version of office. They were to open it, save it and send it back. It was supposed to list the library reference differences. It locked up Excel 2013 instead.... arrrgh... and it looks so promising.

    I could modify the code below to tell me there is a reference problem but it won't identify what libraries are causing it. Could someone help me modify this code to actually list the missing references or perhaps make the code work as it was designed to but work on Win8 with Off2013?

    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 email this workbook to "". In the subject line enter Broken Refs", _
            vbCritical, "Unable To Remove Missing Reference"
        End If
         
        On Error GoTo 0
    End Sub
    Incidentally, it did not pop up a message box...it just froze the workbook.
    Last edited by SamT; 12-11-2013 at 08:18 AM. Reason: Formatted code with # icon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •