By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,663 Members | 1,843 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,663 IT Pros & Developers. It's quick & easy.

How to change reference Libraries when both MS2000 & MS2007 on same machine

100+
P: 167
I have both MS2000 and MS2007 on my machine and am able to successful switching back and forth. I have to have both as I have to maintain some applications in 2000 while working on getting them to run under MS2007 for an upgrade coming soon. I have a button that when clicked will open some word documents, however it is failing in MS2007. This is because my reference library for Word is pointing to "C:\Program Files\Microsoft Office\Office\MSWORD9.OLB" (for 2000) and I need it to reference the 2007 library in "C:\Program Files\Microsoft Office\Office12\MSWORD.OLB". I cannot seem to get this library in the list of reference libraries even when I click on browse and drill down to it. Is there a way to change which object library is pointing to. I understand it is probably not intended to have 2 different versions running on the same machine.
Jun 29 '09 #1
Share this Question
Share on Google+
2 Replies


ADezii
Expert 5K+
P: 8,685
@ncsthbell
You can programmatically Add a Reference to an Access Database in the following fashion. The code below will add a Reference to the Microsoft Scripting Runtime Library. To modify an existing Reference, you would probably have to:
  1. Check for its existence.
  2. Delete the Reference if found.
  3. Add the new Reference.
Expand|Select|Wrap|Line Numbers
  1. VBE.ActiveVBProject.References.AddFromFile "C:\Windows\System32\scrrun.dll"
I figured that while I am at it, I may as well throw in some handy Code for you:
Expand|Select|Wrap|Line Numbers
  1. Dim MyRef As Reference
  2.  
  3. For Each MyRef In Application.References
  4.   Debug.Print "Name: " & MyRef.Name
  5.   Debug.Print "Is the Reference Built-In: " & IIf(MyRef.BuiltIn, "Yes", "No")
  6.   Debug.Print "Full Path: " & MyRef.FullPath
  7.   Debug.Print "Major Version Number: " & MyRef.Major
  8.   Debug.Print "Minor Version Number: " & MyRef.Minor
  9.   Debug.Print "Kind of Reference: " & IIf(MyRef.Kind = 0, "Type Library", "Visual Basic Project")
  10.   Debug.Print "Is the Reference Broken?: " & IIf(MyRef.IsBroken, "Yes", "No")
  11.   Debug.Print "***********************************************"
  12. Next MyRef
On one of my PCs will display:
Expand|Select|Wrap|Line Numbers
  1. Name: VBA
  2. Is the Reference Built-In: Yes
  3. Full Path: C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6.DLL
  4. Major Version Number: 4
  5. Minor Version Number: 0
  6. Kind of Reference: Type Library
  7. Is the Reference Broken?: No
  8. ***********************************************
  9. Name: Access
  10. Is the Reference Built-In: Yes
  11. Full Path: C:\Program Files\Microsoft Office\Office\MSACC9.OLB
  12. Major Version Number: 9
  13. Minor Version Number: 0
  14. Kind of Reference: Type Library
  15. Is the Reference Broken?: No
  16. ***********************************************
  17. Name: Office
  18. Is the Reference Built-In: No
  19. Full Path: C:\Program Files\Microsoft Office\Office\MSO9.DLL
  20. Major Version Number: 2
  21. Minor Version Number: 1
  22. Kind of Reference: Type Library
  23. Is the Reference Broken?: No
  24. ***********************************************
  25. Name: DAO
  26. Is the Reference Built-In: No
  27. Full Path: C:\Program Files\Common Files\Microsoft Shared\DAO\dao360.dll
  28. Major Version Number: 5
  29. Minor Version Number: 0
  30. Kind of Reference: Type Library
  31. Is the Reference Broken?: No
  32. ***********************************************
  33. Name: stdole
  34. Is the Reference Built-In: No
  35. Full Path: C:\WINDOWS\system32\stdole2.tlb
  36. Major Version Number: 2
  37. Minor Version Number: 0
  38. Kind of Reference: Type Library
  39. Is the Reference Broken?: No
  40. ***********************************************
  41. Name: JRO
  42. Is the Reference Built-In: No
  43. Full Path: C:\Program Files\Common Files\System\ado\msjro.dll
  44. Major Version Number: 2
  45. Minor Version Number: 6
  46. Kind of Reference: Type Library
  47. Is the Reference Broken?: No
  48. ***********************************************
  49. Name: ActiveDs
  50. Is the Reference Built-In: No
  51. Full Path: C:\WINDOWS\system32\activeds.tlb
  52. Major Version Number: 1
  53. Minor Version Number: 0
  54. Kind of Reference: Type Library
  55. Is the Reference Broken?: No
  56. ***********************************************
  57. Name: Scripting
  58. Is the Reference Built-In: No
  59. Full Path: C:\WINDOWS\system32\scrrun.dll
  60. Major Version Number: 1
  61. Minor Version Number: 0
  62. Kind of Reference: Type Library
  63. Is the Reference Broken?: No
  64. ***********************************************
Jun 30 '09 #2

100+
P: 167
Thanks! This was very useful for me!
Jun 30 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.