hi
i have this code which reads in my excel file
what i need to do it add this info to a table in my db. i dont need all the info to go in just certain fields.Code:Dim xl As New Excel.Application Dim xlsheet As Excel.Worksheet Dim xlwbook As Excel.Workbook ' Const SHEET_NAME As String = "CreditRatings" Dim i As Integer Dim j As Integer Dim sBuffer As String Dim LastRowColB As Integer Dim fn As Integer Set xlwbook = xl.Workbooks.Open("c:\CreditRatingsReport.xls") Set xlsheet = xlwbook.Sheets.Item("CreditRatings") LastRowColB = xl.Range("B65536").End(xlUp).row fn = FreeFile 'Open sOUTPUT_PATH & "\Ivory_SecuritiesIssued" & ".csv" For Append As #fn For i = 2 To LastRowColB sBuffer = "" For j = 2 To 24 If IsDate(xlsheet.Cells(i, j)) Then sBuffer = sBuffer & Format(xlsheet.Cells(i, j)) & "|" Else sBuffer = sBuffer & Trim(xlsheet.Cells(i, j)) & "|" End If Next j Print #fn, Left(sBuffer, Len(sBuffer) - 1) Next i 'Cleanup Set xlsheet = Nothing If Not xl.ActiveWorkbook Is Nothing Then xl.ActiveWorkbook.Close Set xlwbook = Nothing xl.Quit Set xl = Nothing
any ideas how this is done




Reply With Quote