How to close a file after opening using Application.FileDialog(3) ?

vman008

New member
Local time
Today, 06:14
Joined
Sep 25, 2013
Messages
1
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?

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
 
do you need to open the file after selecting it via the filedialogue box?

David
 

Users who are viewing this thread

Back
Top Bottom