Saves all the Linked tables as Local tables with same data and structure.
Code:
Public Sub LinktoLocal()
Dim td As TableDef, tdCopy As TableDef
If Left(CurrentProject.Path, 1) <> "C" Then Exit Sub ' prevents running this file from the share location
On Error Resume Next
For Each td In CurrentDb.TableDefs
Debug.Print td.Name
If Nz(td.Connect, "") <> "" And (Left(td.Name, 1) <> "~") And (Left$(td.Name, 4) <> "MSys") Then
Set tdCopy = td ' Copy the old table def information
Dim strSplit() As String
strSplit = Split(td.Connect, "=")
DoCmd.DeleteObject acTable, td.Name 'Deleting the link first ensures the re_import doesnt append an oddname
DoCmd.TransferDatabase acImport, "Microsoft Access", strSplit(1), acTable, tdCopy.Name, tdCopy.Name
Set tdCopy = Nothing
End If
Next
Debug.Print "Done"
End Sub