Hi All
I have the following code that relinks tables to Excel files.
It works when the Excel files are saved on my local machine but fails if the files are on shared drive (a mapped drive).
Is there any work around to get it work on shared drive? Thanks !
I have the following code that relinks tables to Excel files.
It works when the Excel files are saved on my local machine but fails if the files are on shared drive (a mapped drive).
Is there any work around to get it work on shared drive? Thanks !
Code:
Sub Test()
Dim db As Database
Dim tbl As TableDef
Dim MyTbl As DAO.TableDef
Dim Path As String
Set db = CurrentDb
For Each tbl In db.TableDefs
If tbl.Name = "TblA" Then
Set MyTbl = tbl
MyTbl.Connect = "Excel 8.0;HDR=YES;IMEX=2;ACCDB=YES;DATABASE=C:\Test Folder\Testing\Test File A.xls[Sheet1$]"
' Fails if I Switch to Share Drive: MyTbl.Connect = "Excel 8.0;HDR=YES;IMEX=2;ACCDB=YES;DATABASE=T:\Test Folder\Testing\Test File A.xls[Sheet1$]"
MyTbl.RefreshLink
Exit Sub
End If
Next
End Sub