Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Programmatically list references in Excel

I have a workbook that uses a reference that may be missing. Is there some
way I can test for it before execution so that an error specifically about
the reference is displayed?

Thanks,
Barb Reinhardt
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default Programmatically list references in Excel

Check out Chip Pearson's Site

http://www.cpearson.com/Excel/MissingReferences.aspx

"Barb Reinhardt" wrote:

I have a workbook that uses a reference that may be missing. Is there some
way I can test for it before execution so that an error specifically about
the reference is displayed?

Thanks,
Barb Reinhardt

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Programmatically list references in Excel

There's Missing, as in "not there at all", but there's also "not quite
right". You can check the IsBroken property of each reference which will
certainly tell you if "not there" but not necessarily if "not right",
typically due to some library version difference.

Dim wb As Workbook
Dim oRef As Object
Set wb = ThisWorkbook
For Each oRef In wb.VBProject.References
Debug.Print oRef.IsBroken, oRef.Name
Next

If you suspect there might be problem with references chances are you code
is going to break before you can even test. But you might just be able to
survive long enough if you fully qualify all your VB functions and
constants. This is particularly important with Strings & DateTime functions
but worth looking at absolutely everything (just one unqualified thing can
make it all fail).

s = VBA.Strings.Left$(

could mean spending a lot of time with the Object Browser

I used this approach where I might be programmatically adding a reference
which I know probably does not exist at the start.

Best approach of course is to work out why you anticipate a problem with
missing ref's and avoid the problem. If you are distributing a file that's
been saved with some later version library than that of the user, there
might be nothing you can do (depending on the particular ref), at least not
programmatically.

Regards,
Peter T


"Barb Reinhardt" wrote in message
...
I have a workbook that uses a reference that may be missing. Is there
some
way I can test for it before execution so that an error specifically about
the reference is displayed?

Thanks,
Barb Reinhardt



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default Programmatically list references in Excel

Try the ISBroken Property

Somthing like....


Debug.Print Application.VBE.ActiveVBProject.References.Item("A DODB").IsBroken



"Barb Reinhardt" wrote:

I have a workbook that uses a reference that may be missing. Is there some
way I can test for it before execution so that an error specifically about
the reference is displayed?

Thanks,
Barb Reinhardt

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
How can I programmatically change Link references? Boulder_dude Links and Linking in Excel 5 June 20th 08 09:44 PM
how to list what references any givin hyperlink in excel dijimajik Excel Discussion (Misc queries) 0 September 24th 07 09:34 PM
Create programmatically list of combinations for choices from data sets in excel vba somethinglikeant Excel Programming 2 July 9th 06 10:26 PM
Programmatically query Excel drop-down list ? diglas1 via OfficeKB.com Excel Programming 2 June 9th 06 11:36 AM
Adding library references programmatically Alan Beban[_2_] Excel Programming 5 August 25th 05 05:21 PM


All times are GMT +1. The time now is 11:15 AM.

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

About Us

"It's about Microsoft Excel"