D
drpkrupa
I have page with one button. If user click on the import button. I would like
to open the file dialog box. User select the text file and click ok then i
would like to transfer the data from text file to access table.
I wrote code which will open file dialog box and user can select text file.
Can anyone help me out how to read the text file and load the data into
access table.
Code for File dialog box.
Dim fDialog As Office.FileDialog
Dim vardirectory As String
vardirectory = "C:\Documents and Settings\user\Desktop\
Dim varFile As Variant
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
AllowMultiSelect = True
Title = "Please select one or more files"
Filters.Clear
Filters.Add "Text Files", "*.txt"
InitialFileName = vardirectory
If .Show = True Then
For Each varFile In .SelectedItems
MsgBox varFile
Next
Else
MsgBox "You clicked Cancel in the file dialog box."
End If
End With
to open the file dialog box. User select the text file and click ok then i
would like to transfer the data from text file to access table.
I wrote code which will open file dialog box and user can select text file.
Can anyone help me out how to read the text file and load the data into
access table.
Code for File dialog box.
Dim fDialog As Office.FileDialog
Dim vardirectory As String
vardirectory = "C:\Documents and Settings\user\Desktop\
Dim varFile As Variant
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
AllowMultiSelect = True
Title = "Please select one or more files"
Filters.Clear
Filters.Add "Text Files", "*.txt"
InitialFileName = vardirectory
If .Show = True Then
For Each varFile In .SelectedItems
MsgBox varFile
Next
Else
MsgBox "You clicked Cancel in the file dialog box."
End If
End With