Monday 15 July 2013

vbscript - convert excel file to txt file (without carriage returns) -


I want to convert the excel files into tab limited textile files (without the carrier's return) I'm currently using scripts I am (found in this forum) which extensively extract Excel files to .txt files.

The script is

  '@file: xl2tab.vbs' @author: Stephen Brown - sb09d@fsu.edu' @date: 2009-December -10 ':' @usage '@description convert excel files to the public tab-delimited files' top-level directory where excellence will use all subdirectories contained in files and double-click "script and" delimited file for each Excel file . All produce "output" folder, which FSO set retains the original directory structure of dim 'saveDirBase = CreateObject ( "Scripting.FileSystemObject") set shell = CreateObject ( "WScript.Shell") set objExcel = CreateObject ( "Excel. Application will be ") set top = fso.GetFolder (shell.CurrentDirectory) saveDirBase = Top & amp; "\" & Amp; Set the "Output" sub-tracefolders (path) folder = fso.GetFolder (path) to each item in the XL2Tab (folder) folder. SBF folders if item.Path & lt; & Gt; TraverseFolders saveDirBase then call (item.Path) end then next set folder = nothing End Sub Sub XL2Tab (folder) dim saveDir set files = folder.Files then folder.Name & lt; & Gt; Top.Name then saveDir = saveDirBase & amp; "\" & Amp; Otherwise saveDir = saveDirBase folder.Name ending fso.FolderExists (saveDir) = So then false then fso.CreateFolder (saveDir) files in each file then file.Name & lt then end; & Gt; Wscript.ScriptName then objExcel.Application.DisplayAlerts = false set objWorkbook = objExcel.Workbooks.open (folder.Path & amp; "\" & amp; file.Name) objWorkbook.SaveAs saveDir & amp; "\" & Amp; FileName & amp; ".txt", -4158 objWorkbook.close objExcel.Application.DisplayAlerts = True End Next End Sub fso.FolderExists (saveDirBase) = if false then fso.CreateFolder (saveDirBase) Hang TraverseFolders (above)  < Before I change / before> 

I want to remove the carriage return in every Excel file.

Please guide me to anyone!

< / Pre>

Call the module inside of your process, after closing the workbook objWorkbook.close just

  remove the cache (file.Name & ".txt") < / Code>   

No comments:

Post a Comment