Tuesday, 5 February 2013

Convert .CSV file to Excel File(.xls)(1997-2003) with Proper Formating Using VB Script

Convert .CSV file to Excel File(.xls)(1997-2003) with Proper Formating Using VB Script

Dim objXLApp, objXLWb, objXLWs
Set objXLApp = CreateObject("Excel.Application")
objXLApp.Visible = False
Set objXLWb = objXLApp.Workbooks.Open ("C:\Documents and Settings\Ayaskant Jena\Desktop\OPOM_NBN_Original_1.csv")
'~~> Save as Excel File (xls) to retain format
objXLWb.SaveAs "C:\Documents and Settings\Ayaskant Jena\Desktop\OPOM_NBN.xls", 56
Set ExcelObject = CreateObject("Excel.Application")
ExcelObject.visible = False
ExcelObject.Workbooks.Open  ("C:\Documents and Settings\Ayaskant Jena\Desktop\OPOM_NBN.xls")
intRowCount = ExcelObject.ActiveSheet.UsedRange.Rows.Count
intColumnCount = ExcelObject.ActiveSheet.UsedRange.Columns.Count
ExcelObject.Sheets(1).name = "MasterData"
objXLWb.Close (False)
Set ExcelObject = Nothing
Set objXLApp = Nothing

2 comments:

  1. Can you please explain the above code. Thanks.

    ReplyDelete
  2. that is the top notch mind-set, though is just not assistance to make every one sence in any respect preaching now not quite that mather. virtually any method many thanks in toting taking place to i had goings-on to express your very own article in to delicius nonetheless it's far seemingly a dilemma the use of your steering web sites can you are making smile recheck the concept. thank you then again. convert to nef

    ReplyDelete