Hi guys,
I have been looking for a solution to close a file whenever Application.FileDialog is executed to open a file. It seems that I get file read access error when the same excel file is already opened using Application.FileDialog.
Can someone please let me know how to close the file after it is opened through VBA in Access?
I have been looking for a solution to close a file whenever Application.FileDialog is executed to open a file. It seems that I get file read access error when the same excel file is already opened using Application.FileDialog.
Can someone please let me know how to close the file after it is opened through VBA in Access?
Code:
Dim f As Object
Set f = Application.FileDialog(3)
f.AllowMultiSelect = False
If f.Show Then
For i = 1 To f.SelectedItems.Count
sFile = Filename(f.SelectedItems(i), sPath)
Next
End If