smtazulislam
Member
- Local time
- Today, 17:17
- Joined
- Mar 27, 2020
- Messages
- 808
Hello,
Any help will appreciate....
I want to import an Excel Spreadsheet file & display in a list box for temporally, Check the data then KILL import excel Spreadsheet .
Any help will appreciate....
Code:
Private Sub cmdBrowser_Click()
'Dim fDialog As Office.FileDialog
Dim fDialog As Object
Dim item As Variant
Dim Ist As Variant
Dim FSO As New FileSystemObject
'Set up File dialog box
'Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
Set fDialog = Application.FileDialog(3)
.AllowMultiSelect = False
.Title = "Please select an Excel Spreadsheet"
.Filters.Clear
.Filters.Add "Excel Spreadsheets", "*.xls, *.xlsx"
If fDialog.Show Then
For Each item In fDialog.SelectedItems
Me.txtPath = item
Next
End If
If FSO.FileExists(Nz(Me.txtPath, "")) Then
ExcelImport.ImportExcelSpreadsheet Me.txtPath, FSO.GetFileName(Me.txtPath & Now())
Me.lstNewGosi = Ist
Next
If Nz(Me.txtPath, "") = "" Then
MsgBox "Please select a file!"
Exit Sub
End If
End If
End Sub
I want to import an Excel Spreadsheet file & display in a list box for temporally, Check the data then KILL import excel Spreadsheet .