View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default code to check for project references in VBA

Qasim,

Sub testit()
Dim ref As Object

For Each ref In ThisWorkbook.VBProject.References
If ref.IsBroken Then Debug.Print ref.Name & " is broken"
Next
End Sub

Rob


"Qasim Ahmad" wrote in message
om...
Hi everyone,

Can someone please help me out here. I'm trying to check is all the
project references are valid for a VBA piece of code i have written
and need to distribute. Currently, if there is a broken reference,
the vba just ends up spiting out a runtime error. Is there an elegant
way to check for this through the code. I did see examples using
VBPRoject, but i am not using this object. im using pure vba.
Thanks in advance :)