Return to Snippet

Revision: 2687
at March 27, 2007 14:20 by corydeppen


Initial Code
Sub saveExcelAsCsv(ExcelFileName As String)

    Dim objXlApp As New Excel.Application
    Dim objXlBook As Excel.Workbook
    
    ' Setup the Excel Workbook to save
    Set objXlBook = Excel.Workbooks.Open(ExcelFileName)
    
    ' Save the Excel file as a CSV file in a temp location
    objXlBook.SaveAs "c:\Windows\Temp\tmpCsvFromExcel.txt", xlCSVWindows
    
    ' Clean up
    objXlBook.Close True    ' Save changes
    objXlApp.Quit           ' Close Excel
    Set objXlBook = Nothing
    Set objXlApp = Nothing

End Sub

Initial URL

                                

Initial Description

                                

Initial Title
Save Excel File as CSV

Initial Tags
excel

Initial Language
Visual Basic