I inserted a new worksheet in the workbook and named it "libs"
I modified the code as shown:
Sub References_RecordMissing()
'''''''''''''''''Macro purpose: To record missing references from the VBE
'Macro purpose: To Record missing references in the Project
Dim theRef As Variant, i As Long, j As Long
Dim WkSht As Worksheet
Dim MyFlag As Boolean 'Personal preference. Clearing all Errors as soon as possible.
WkSht = ("libs")
'YOU insert WkSht into workbook as New Worksheet here.
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
MyFlag = True
j = j + 1
WkSht.Range("A" & CStr(j)) = theRef.Name
'ThisWorkbook.VBProject.References.Remove theRef
End If
Err = 0
Next i
'If Err <> 0 Then
If MyFlag Then
Me.Save [this line is highlighted]
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
When I compile I get [ "Invalid Use of Keyword Me"] error
Since I'm outputting to the new worksheet can I eliminate this section and just end the sub at that point?
Err = 0
Next i
'If Err <> 0 Then
If MyFlag Then
Me.Save [this line is highlighted]
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"
There by ending up with this:
Sub References_RecordMissing()
'''''''''''''''''Macro purpose: To record missing references from the VBE
Dim theRef As Variant, i As Long, j As Long
Dim WkSht As Worksheet
Dim MyFlag As Boolean 'Personal preference. Clearing all Errors as soon as possible.
WkSht = ("libs")
'YOU insert WkSht into workbook as New Worksheet here.
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
MyFlag = True
j = j + 1
WkSht.Range("A" & CStr(j)) = theRef.Name
End If
End Sub