Quote:
Originally Posted by ncsthbell
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.
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:
- Check for its existence.
- Delete the Reference if found.
- Add the new Reference.
- 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:
- Dim MyRef As Reference
-
-
For Each MyRef In Application.References
-
Debug.Print "Name: " & MyRef.Name
-
Debug.Print "Is the Reference Built-In: " & IIf(MyRef.BuiltIn, "Yes", "No")
-
Debug.Print "Full Path: " & MyRef.FullPath
-
Debug.Print "Major Version Number: " & MyRef.Major
-
Debug.Print "Minor Version Number: " & MyRef.Minor
-
Debug.Print "Kind of Reference: " & IIf(MyRef.Kind = 0, "Type Library", "Visual Basic Project")
-
Debug.Print "Is the Reference Broken?: " & IIf(MyRef.IsBroken, "Yes", "No")
-
Debug.Print "***********************************************"
-
Next MyRef
On one of my PCs will display:
- Name: VBA
-
Is the Reference Built-In: Yes
-
Full Path: C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6.DLL
-
Major Version Number: 4
-
Minor Version Number: 0
-
Kind of Reference: Type Library
-
Is the Reference Broken?: No
-
***********************************************
-
Name: Access
-
Is the Reference Built-In: Yes
-
Full Path: C:\Program Files\Microsoft Office\Office\MSACC9.OLB
-
Major Version Number: 9
-
Minor Version Number: 0
-
Kind of Reference: Type Library
-
Is the Reference Broken?: No
-
***********************************************
-
Name: Office
-
Is the Reference Built-In: No
-
Full Path: C:\Program Files\Microsoft Office\Office\MSO9.DLL
-
Major Version Number: 2
-
Minor Version Number: 1
-
Kind of Reference: Type Library
-
Is the Reference Broken?: No
-
***********************************************
-
Name: DAO
-
Is the Reference Built-In: No
-
Full Path: C:\Program Files\Common Files\Microsoft Shared\DAO\dao360.dll
-
Major Version Number: 5
-
Minor Version Number: 0
-
Kind of Reference: Type Library
-
Is the Reference Broken?: No
-
***********************************************
-
Name: stdole
-
Is the Reference Built-In: No
-
Full Path: C:\WINDOWS\system32\stdole2.tlb
-
Major Version Number: 2
-
Minor Version Number: 0
-
Kind of Reference: Type Library
-
Is the Reference Broken?: No
-
***********************************************
-
Name: JRO
-
Is the Reference Built-In: No
-
Full Path: C:\Program Files\Common Files\System\ado\msjro.dll
-
Major Version Number: 2
-
Minor Version Number: 6
-
Kind of Reference: Type Library
-
Is the Reference Broken?: No
-
***********************************************
-
Name: ActiveDs
-
Is the Reference Built-In: No
-
Full Path: C:\WINDOWS\system32\activeds.tlb
-
Major Version Number: 1
-
Minor Version Number: 0
-
Kind of Reference: Type Library
-
Is the Reference Broken?: No
-
***********************************************
-
Name: Scripting
-
Is the Reference Built-In: No
-
Full Path: C:\WINDOWS\system32\scrrun.dll
-
Major Version Number: 1
-
Minor Version Number: 0
-
Kind of Reference: Type Library
-
Is the Reference Broken?: No
-
***********************************************