PDA

View Full Version : Can you tell if a open book has this workbook as a reference



RowinABoat
11-17-2008, 07:55 AM
Hi,

I have a xls file with central code I use in a number of books and I'm looking for a way to check if a open workbook is referencing the code.
I need to do this in the code book not the book thats referencing it.

any ideas???

RowinABoat
11-17-2008, 08:20 AM
By the way if more information is needed just ask me.

The project is referenced in another project and the referenced project needs to be able to tell if the project that referres to it is open. (hope that makes sense)

Kenneth Hobs
11-17-2008, 08:26 AM
If ActiveWorkbook.Name<>ThisWorkbook.Name then MsgBox "Oops"

RowinABoat
11-17-2008, 08:33 AM
Thanks Kennith but this is not what I mean.

Say my project is Book1.xls or Book2.xls or any workbook for that matter.
It has a reference to Code1.xls workbook in the project throught Tools>References
Ineed to be able to check in a macro in Code1.xls if a book1.xls is open and reverencing this Code1.xls workbook,

There are unlimited possible variations on book1.xls that reference Code1.xls

does this make sense??

regards,

Kenneth Hobs
11-17-2008, 09:08 AM
You want to check the references for each open workbook? If so, then you can iterate the workbooks collection and use VBProject.References. A search for it at this site will provide examples. Another link that you can review is: http://www.excelkb.com/default.aspx?cNode=3M2R1E&pNodes=0U2O7J