Originally Posted by
orange
Please post some sample data and give an example of what you need for output.
This is the code I am using
Code:
Function ImportData()
Dim excelapp As Object
Dim wb As Object
Dim importFile As String
Dim importPath As FileDialog
Dim rowNum As Long
Set importPath = Application.FileDialog(msoFileDialogFilePicker)
With importPath
.AllowMultiSelect = False
.Title = "Select the import file"
.Filters.Add "All Files", "*.*"
If .Show = -1 Then
importFile = .SelectedItems(1)
'Capture the range to import
Set excelapp = CreateObject("excel.application")
Set wb = excelapp.Workbooks.Open(importFile)
rowNum = excelapp.Application.CountA(wb.worksheets(1).Range("A1:a1048576"))
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12Xml, "Test", importFile, True, "A1:AP" & rowNum
wb.Close
Set wb = Nothing
excelapp.Quit
Set excelapp = Nothing
Else
MsgBox "You did not select a spreadsheet to import"
End If
End With
End Function
And this is a sample spreadsheet http://www.filedropper.com/book1_4
I'm on a MacBook and it won't let me upload my csv or convert to a .zip for "security" on this work computer.