Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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 :)
  #2   Report Post  
Posted to microsoft.public.excel.programming
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 :)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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 :)

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Missing VBA Project References for non-VBA commands Rock Chalk Julie Excel Discussion (Misc queries) 1 January 12th 07 06:11 PM
VB Project References Tom Chau Excel Discussion (Misc queries) 0 July 18th 06 05:17 AM
unlock project with VBA code Konrad[_5_] Excel Programming 0 November 25th 03 08:50 PM
Discussion: VBA Project Code Protection Edwin Tam (MS MVP) Excel Programming 2 November 14th 03 01:24 PM
inserted code into project but can't run it in run dialogbox cpudenusa Excel Programming 3 July 19th 03 06:24 PM


All times are GMT +1. The time now is 07:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"