lickalotapus
New Member
- Joined
- Jul 10, 2002
- Messages
- 24
Hi all,
I have a database in Access XP which I share with an Access 2000 user. There are several functions in the database which output things to Excel. Therefore, the Excel object library is loaded under Tools...References.
The problem is that everytime I open the database (in XP), this reference gets updated to Excel 10.0 object model. Then, when the Access 2000 user opens the database, they get a missing library error and have to manually de-select the Excel 10.0 object model and select the Excel 9.0 object model.
I am trying to get around this whole mess by creating a simple auto_exec macro which checks for missing references, deletes them, and adds the correct reference.
So far I've been able to loop through all of the references in the database and check the IsBroken property to tell me what's not working. I am also able to add a reference using the AddFromGUID method of the References collection. However, I cannot seem to remove a broken reference, no matter what I do. Here is a bit of sample code to give an idea what I'm attempting...
When I attempt to run this in the database containing a missing reference, I get a "Object Library Not Registered" run-time error. Yet I have no problem removing the reference manually. I feel like I'm one step away from conquering this whole problem, so if anyone could shed some light on how to programmatically remove a reference, it would be greatly appreciated.
I have a database in Access XP which I share with an Access 2000 user. There are several functions in the database which output things to Excel. Therefore, the Excel object library is loaded under Tools...References.
The problem is that everytime I open the database (in XP), this reference gets updated to Excel 10.0 object model. Then, when the Access 2000 user opens the database, they get a missing library error and have to manually de-select the Excel 10.0 object model and select the Excel 9.0 object model.
I am trying to get around this whole mess by creating a simple auto_exec macro which checks for missing references, deletes them, and adds the correct reference.
So far I've been able to loop through all of the references in the database and check the IsBroken property to tell me what's not working. I am also able to add a reference using the AddFromGUID method of the References collection. However, I cannot seem to remove a broken reference, no matter what I do. Here is a bit of sample code to give an idea what I'm attempting...
Code:
Dim ref As Reference
For Each ref In References
If ref.IsBroken = True Then Application.References.Remove ref
Next
When I attempt to run this in the database containing a missing reference, I get a "Object Library Not Registered" run-time error. Yet I have no problem removing the reference manually. I feel like I'm one step away from conquering this whole problem, so if anyone could shed some light on how to programmatically remove a reference, it would be greatly appreciated.