How Do I Import An Excel Spreadsheet
by admin on Saturday, August 17th, 2013 | No Comments
How Do I Import An Excel Spreadsheet
In this video you will find the
answer to the question “How do I import an excel spreadsheet into my Access database?”
Option Compare Database '======================================================== 'DATABASE DESIGNED & CODED BY LOEBLCOM SERVICES 2013 'ERIK LOEBL(713)409-7041 'EMAIL: erik@loeblcomservices.com 'WEB: http://loeblcomservices.com '======================================================== Dim m_strFileName As String Private Sub btnImport_Click() DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "spreadsheet name", m_strFileName, True End Sub Private Sub btnLocateFile_Click() Dim varItem As Variant Dim strPath As String Dim objFilePicker As FileDialog Dim db As Database Dim rst As DAO.Recordset Dim strUnitNumber As String Set db = CurrentDb() Set objFilePicker = Application.FileDialog(msoFileDialogFilePicker) With objFilePicker 'Setup file dialog .AllowMultiSelect = False .ButtonName = "Select" .InitialView = msoFileDialogViewList .Title = "Select File" 'add filter for all files With .Filters .Clear .Add "All Files", "*.xlsx" End With .FilterIndex = 1 'disply dilog boxe .Show End With If objFilePicker.SelectedItems.Count > 0 Then m_strFileName = objFilePicker.SelectedItems(1) End If End Sub
Click here for the database and the code:
How Do I Import An Excel Spreadsheet