Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing Excel

Status
Not open for further replies.

BSando

Technical User
Jun 29, 2003
73
0
0
AU
Hi All,

I want users to import an excel file to a table. I want the user to be able to select the file they import because every file will not have the same name. Everyfile will have the same format.

I have tried the Transferspreadsheet cmd but i get an error because I don't have the file name allocated.

Anyhelp would be appreciated.

Some people make things happen, some watch while things happen, and some wonder 'What happened?'
 
I think this can simplify the call.
Code:
Private Sub btnBrowse_Click()
'Set reference to Microsoft Office x.xx Object Library
    Dim dlgOpen As FileDialog
    Set dlgOpen = Application.FileDialog(msoFileDialogOpen)
    With dlgOpen
        .AllowMultiSelect = False
        .Filters.Add "Excel Files", "*.xls", 1
        .Show
    End With
    dbname = dlgOpen.SelectedItems(1)
    Me.txtExcelFileName.Value = dbname
End Sub

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top