-
Notifications
You must be signed in to change notification settings - Fork 3
/
M_omReferenceFunctions.def
59 lines (49 loc) · 1.44 KB
/
M_omReferenceFunctions.def
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Option Compare Database
Option Explicit
Public Sub ListReferences()
Dim R As Reference
Dim n As String
Dim P As String
On Error Resume Next
For Each R In Application.References
n = ""
n = R.Name
P = ""
P = R.FullPath
Debug.Print "omReferenceFunctions.AddReference " & Chr(34) & P & Chr(34) & " ' -> " & n
Next
End Sub
Public Sub AddReference(filename As String)
RemoveReference filename
Application.References.AddFromFile filename
End Sub
Public Function FindReference(Name As String) As Reference
Dim R As Reference
Set R = Nothing
For Each R In Application.References
If InStr(1, R.Name, Name) > 0 Then
Set FindReference = R
Exit Function
End If
If InStr(1, R.FullPath, Name) > 0 Then
Set FindReference = R
Exit Function
End If
Next
End Function
Public Sub RemoveReference(filename As String)
Dim R As Reference
Set R = FindReference(filename)
If Not (R Is Nothing) Then
Application.References.Remove R
End If
End Sub
Public Sub AddVBIDEReference()
AddReference "C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB"
End Sub
Public Sub AddAdoDbReference()
AddReference "C:\Program Files (x86)\Common Files\System\ado\msado28.tlb"
End Sub
Public Sub AddScriptingReference()
AddReference "C:\Windows\SysWOW64\scrrun.dll" ' -> Scripting
End Sub