hsingh1981
Programmer
Hi all,
I have a problem, I can open an excel sheet and retrieve a paticular cell data and store it to my table. How do i tell it to go through each cell and move down and store it excel table?
eg.
a9
a10
a11
and retrieve the data in each cell and save it to table?
This is what i got so far with one cell
Many thanks
I have a problem, I can open an excel sheet and retrieve a paticular cell data and store it to my table. How do i tell it to go through each cell and move down and store it excel table?
eg.
a9
a10
a11
and retrieve the data in each cell and save it to table?
This is what i got so far with one cell
Code:
DoCmd.SetWarnings False
DoCmd.Hourglass True
Dim cFso
Set cFso = CreateObject("Scripting.FileSystemObject")
Dim MyProperPath As String
Dim myRec As DAO.Recordset
Dim xlApp, xlApp2 As Excel.Application
Dim xlWrksht, xlWrkshtBBE As Excel.Worksheet
'Name of Table
Set myRec = CurrentDb.OpenRecordset("T_LOS")
'Excel sheet creat and finding path
Set xlApp = CreateObject("Excel.Application")
'Make sure the path is in the right format
MyProperPath = txtExcelFileLocation
Set xlWrksht = xlApp.Workbooks.Open(MyProperPath)
'MsgBox MyFileName
myRec.AddNew
myRec.Fields("HRGs") = xlWrksht.Worksheets("Length of Stay").Cells(9, "A")
myRec.Update
xlApp.Workbooks.Close
DoCmd.SetWarnings True
'Me.Combo14.Requery
DoCmd.Hourglass False
Many thanks