![]() |
code to check for project references in VBA
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 :) |
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 :) |
code to check for project references in VBA
Thanks! another problem i was having was that i was not referencing
the Microsoft Visual Basic Extensibitiy library, which allows me to use the VBProject object. Once i figured that out, the code below works. thanks again. "Rob van Gelder" wrote in message ... 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 :) |
All times are GMT +1. The time now is 12:06 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com