Trinity Envision Business Services LLC - IT Staffing - Unique Just-in-time-saves-9 methodology
Excel File Split into CSV Output Files Code.
Click to download the code, Rename as filename.vbs and double click to run
Download


Dim xlApp, fso ' Object Variables defined

Dim vFilePath, getbase, objArgs ' Defining all variables upfront

set fso = createobject("scripting.filesystemobject") ' FSO > File system object pointer to input file

Set objArgs = WScript.Arguments ' To be used later for parameter passing and leverage in Certify

vFilepath = "\\folder\subfolder\sub-sub-folder" ' Currently hard coded & can be made dynamic based on input arguments

vFilename = "sample_details.xlsx" ' I/P Sample details file -- this can be Sample_Details.xls or Sample_Details.xlsx file

getbase = fso.getbasename(vFilename) ' Remove the filename extension from the INPUT file, so it can be saved as .CSV file

Set xlApp = CreateObject("excel.application")
With xlApp.Workbooks.Open(vFilePath & vFilename) ' open the xls file
     .SaveAs vFilepath & getbase & ".csv", 23 ' text file then = 42, XLSX file = 51, CSV file = 23
     .Close True 'save and close
End With

xlApp.Quit                   ' Quitting Excel Application

Set xlApp = Nothing ' Removing memory allocation
Set fso = Nothing      ' Removing memory allocation


Free Search Engine Submission and Internet Marketing