Option Compare Database Option Private Module Option Explicit ' Import References from a CSV, true=SUCCESS Public Function ImportReferences(ByVal obj_path As String) As Boolean Dim fso As Object Dim InFile As Object Dim line As String Dim item() As String Dim GUID As String Dim Major As Long Dim Minor As Long Dim filename As String Dim refName As String Dim count As Integer count = 0 filename = dir$(obj_path & "references.csv") If Len(filename) = 0 Then ImportReferences = False Exit Function End If Set fso = CreateObject("Scripting.FileSystemObject") Set InFile = fso.OpenTextFile(obj_path & filename, iomode:=ForReading, create:=False, Format:=TristateFalse) On Error GoTo failed_guid Do Until InFile.AtEndOfStream line = InFile.readline item = Split(line, ",") If UBound(item) = 2 Then 'a ref with a guid GUID = Trim$(item(0)) Major = CLng(item(1)) Minor = CLng(item(2)) Application.References.AddFromGuid GUID, Major, Minor count = count + 1 Else refName = Trim$(item(0)) Application.References.AddFromFile refName count = count + 1 End If go_on: Loop On Error GoTo 0 InFile.Close Set InFile = Nothing Set fso = Nothing logger "ImportReferences", "INFO", count & " imported from " & filename ImportReferences = True Exit Function failed_guid: If err.number = 32813 Then 'The reference is already present in the access project - so we can ignore the error Resume Next Else logger "ImportReferences", "ERROR", "Failed to register " & GUID Resume go_on End If End Function ' Export References to a CSV Public Sub ExportReferences(ByVal obj_path As String) Dim fso As Object Dim OutFile As Object Dim line As String Dim ref As Reference Dim count As Integer count = 0 Set fso = CreateObject("Scripting.FileSystemObject") Set OutFile = fso.CreateTextFile(obj_path & "references.csv", overwrite:=True, unicode:=False) For Each ref In Application.References If ref.GUID <> vbNullString Then ' references of types mdb,accdb,mde etc don't have a GUID If Not ref.BuiltIn Then line = ref.GUID & "," & CStr(ref.Major) & "," & CStr(ref.Minor) OutFile.WriteLine line logger "ExportReferences", "DEBUG", "> Reference " & line & " exported" count = count + 1 End If Else line = ref.FullPath OutFile.WriteLine line logger "ExportReferences", "DEBUG", "> Reference " & line & " exported" count = count + 1 End If Next OutFile.Close logger "ExportReferences", "INFO", count & " references exported to" & obj_path & "references.csv" End Sub