Private Sub Command93_Click()
Dim f As Object
Dim strFile As String
Dim strFolder As String
Dim varItem As Variant
Dim P As String
Dim DeleteEverything As String
DoCmd.SetWarnings False
DeleteEverything = "DELETE * FROM [TABLE]"
DoCmd.RunSQL DeleteEverything
Set f = Application.FileDialog(3)
f.AllowMultiSelect = False
If f.Show Then
For Each varItem In f.SelectedItems
strFile = Dir(varItem)
strFolder = Left(varItem, Len(varItem) - Len(strFile))
P = strFolder & strFile
Next
End If
Set f = Nothing
DoCmd.TransferText acImportFixed, "[IMPORT SPECIFICATION]", "[TABLE]", P, False
End Sub
Câu hỏi của tôi là cách đặt mặc định FileDialog thành một thư mục cụ thể khi mở thư mục lần đầu?Mặc định một thư mục cho FileDialog trong VBA
Cảm ơn trước sự giúp đỡ nào trong vấn đề này
Kiểm tra mã được cung cấp ở đây: http://stackoverflow.com/questions/9399651/picking-a-folder- using-application-filedialog –