Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Import CSV file Excel Comma seperated
;//////////////////////////////////////////////////////////////////////// ;// WINBATCH - CSV File To Excel - Could be used with LAFF databases // ;//////////////////////////////////////////////////////////////////////// ;// 1. Loads CSV file - uses just messaqe box, Excel is hidden // ;// 2. Autoformats the workarea, then saves as XLS File. // ;// 3. Feel free to modify as needed. // ;// Stan Littlefield Winbatch 2002C - 03/17/2002 // ;//////////////////////////////////////////////////////////////////////// ; some standard pre-formats to practice with xlRAF3DEffects1 = 13 xlRAF3DEffects2 = 14 xlRAFAccounting1 = 4 xlRAFAccounting2 = 5 xlRAFAccounting3 = 6 xlRAFAccounting4 = 17 xlRAFClassic1 = 1 xlRAFClassic2 = 2 xlRAFClassic3 = 3 xlNormal = -4143 cCSV = AskFileName("Select Comma Separated File",".\","CSV Files|*.csv|","*.csv",1) cXLS = StrReplace( StrUpper(cCSV), ".CSV",".XLS") cText = StrCat("Transferring %cCSV%",@CRLF,"TO %cXLS%") IF FileExist(cXLS) Then FileDelete(cXLS) BoxOpen("Creating Excel WorkBook",cText) oAPP = ObjectOpen( "Excel.Application" ) oAPP.Visible = @FALSE oAPP.DisplayAlerts = @FALSE oWK = oAPP.workbooks oWK.open(cCSV) oACT = oAPP.ActiveWorkbook oWKS = oAPP.Worksheets oWS = oAPP.Worksheets(1) oWS.Activate gosub AutoFit oACT.SaveAs ( cXLS,xlNormal , , , , ,@True ) ObjectClose(oWS) oACT.Close() ObjectClose(oACT) ObjectClose(oWK) ObjectClose(oAPP) BoxShut() IF FileExist(cXLS) Then Message("Conversion Successful","%cXLS% Created.") Exit :AutoFit oCell = oWS.Cells(1,1) oRegion = oCell.CurrentRegion oCols = oRegion.Columns oCols.AutoFit oCell = oWS.UsedRange oCell.AutoFormat(:: Format=xlRAFClassic3) ObjectClose(oRegion) ObjectClose(oCell) Return
Article ID: W15254
File Created: 2002:09:05:13:50:50
Last Updated: 2002:09:05:13:50:50