|
DAOも作ってみました。
こちらは最新のものを参照する形にしてみました。
Function DAOの参照設定()
Dim Refs As References
Dim DAOGUID As String
Dim Majo As Long
Dim Mino As Long
Dim i As Long
DAOGUID = "{00025E01-0000-0000-C000-000000000046}"
Set Refs = Application.References
For i = Refs.Count To 1 Step -1
If Refs(i).IsBroken Then
Application.References.Remove Refs(i)
Else
If Refs(i).Guid = DAOGUID Then Application.References.Remove Refs(i)
End If
Next
Set Refs = Nothing
For i = 1 To 3
Select Case i
Case 1: Majo = 5: Mino = 0 'DAO3.6
Case 2: Majo = 4: Mino = 0 'DAO3.5
Case 3: Majo = 3: Mino = 5 'DAO2.5/3.5
End Select
On Error Resume Next
Application.References.AddFromGuid DAOGUID, Majo, Mino
If Err.Number = 0 Then Exit For
Next
Select Case Err.Number
Case 0
Case -2147319779
MsgBox "DAOのライブラリが見つかりませんでした。"
Case Else
MsgBox Err.Description
End Select
End Function
|
|