Hello,
I want to convert from Excel to Text using VBA Access 2002, works OK but it puts the quotes at the begininng and end of each line
Thanks
This is the result:
"W01069/011H/2013-05-01/2013-08-09/12/SINNATHURAI,RUKSHAN"
"W34639/I61H/2013-05-11/2013-08-09/99/CORRIVEAU,CAROLE-ANNE"
"U43529/047H/2013-06-25/2013-08-16/12/CHALUT, STEPHANIE"
"W00864/011H/2013-05-01/2013-08-16/12/ABDELMALIK, YANIS"
Instead of this
W42577/312H/2013-07-20/2013-08-23/99/MATRAG, SANAA
W42177/312H/2013-07-06/2013-08-23/99/BUREAU, ALEXANDRE
W10023/011H/2013-05-01/2013-08-30/12/ NGO,VAN RICHARD
W35514/312H/2013-05-21/2013-08-30/99/BOSSOU,ROLAND
This the code from VBA
If oExcel Is Nothing Then Set oExcel = CreateObject("Excel.Application")
oExcel.Workbooks.Open chmFichierExcel
oExcel.Worksheets("Feuil1").Activate
LastRow = oExcel.Cells.SpecialCells(xlCellTypeLastCell).Row
LastCol = oExcel.Cells.SpecialCells(xlCellTypeLastCell).Column
oExcel.Workbooks.Open chmFichierExcel
oExcel.Worksheets("Feuil1").Activate
CellData = ""
FilePath = chmFichierTexte
LenCount = 0
Open FilePath For Output As #2
'Remove the headers from the Excel file
For i = 2 To LastRow
For j = 1 To LastCol - 1
If j = LastCol - 1 Then
CellData = CellData + Trim(oExcel.ActiveSheet.Cells(i, j).Value)
Else
CellData = CellData + Trim(oExcel.ActiveSheet.Cells(i, j).Value) + Split
End If
Next j
LenCount = Len(CellData2)
If LenCount > LastCol Then Write #2, CellData2 'At least one letter
CellData = ""
Next i
Close #2
Bookmarks