Tuesday, March 27, 2012

Save Excel File as .csv File

''*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
''* Function : SaveExcelAsCSV(Dest_File, Source_File)
''* Description : Saves the Excel file in csv format
''* Developed By : Baba Fakruddin D
''* Input : DestinationFile, SourceFile
''* Output : NA
''* Syntax : SaveExcelAsCSV "C:\Test.xls", "C:\Test.csv"
''*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Function SaveExcelAsCSV(Dest_File, Source_File)
    Dim objExcel, objExcelBook
    Set objExcel = createobject("Excel.application")
    Set objExcelBook = objExcel.Workbooks.Open(Source_File)
           
    objExcel.application.visible=false
    objExcel.application.displayalerts=false            
    objExcelBook.SaveAs Dest_File, 23
    objExcel.Quit 
      
    Set objExcel = Nothing
    Set objExcelBook = Nothing
End Function
''*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"A good threat is worth a thousand tests" - Boris Beizer

No comments:

There was an error in this gadget