G
Gareth
I posted a few days ago and got the following cod to remove any 'MISSING'
References form my '97 file after it has been worked on in a newer version:
Sub removebrokenreferences()
Dim Counter As Integer
With ThisWorkbook.VBProject.References
For Counter = 1 To .Count
If .Item(Counter).IsBroken Then
.Remove .Item(Counter)
End If
Next
End With
End Sub
I can't seem to get it to work properly. In my Reference box I have 7
ticked, the last 2 are 'MISSING' and are obviously the ones I want to
remove. When I run the macro it gets rid of the first but not the second,
is it something to do with the .Count bit?
It counts 7 so checks 7 References, but after the 6th is checked and removed
because it is broken there isn't a 7th to check so instead looks at an
unticked reference which causes an error. The second 'MISSING' becomes the
6th in the box so is not checked.
Is my theory correct?
If so, is there a way around it?
Thanks in advance.
References form my '97 file after it has been worked on in a newer version:
Sub removebrokenreferences()
Dim Counter As Integer
With ThisWorkbook.VBProject.References
For Counter = 1 To .Count
If .Item(Counter).IsBroken Then
.Remove .Item(Counter)
End If
Next
End With
End Sub
I can't seem to get it to work properly. In my Reference box I have 7
ticked, the last 2 are 'MISSING' and are obviously the ones I want to
remove. When I run the macro it gets rid of the first but not the second,
is it something to do with the .Count bit?
It counts 7 so checks 7 References, but after the 6th is checked and removed
because it is broken there isn't a 7th to check so instead looks at an
unticked reference which causes an error. The second 'MISSING' becomes the
6th in the box so is not checked.
Is my theory correct?
If so, is there a way around it?
Thanks in advance.