Save As multiple files in VB

Hi,

Using the Script for VB worked to open multiple .xls files.  Now I want to add to the code and Save As Text files with original name.

thx

February 13th, 2014 10:33am

Hi,

Using the Script for VB worked to open multiple .xls files.  Now I want to add to the code and Save As Text files with original name.

What script are you referring to?

Please post your entire script and all of your errors. We'll also need a more in depth explanation of what you're trying to do.

Free Windows Admin Tool Kit Click here and download it now
February 13th, 2014 12:01pm

Hi,

Using the Script for VB worked to open multiple .xls files.  Now I want to add to the code and Save As Text files with original name.

thx

For VB questions post in the VB forum

For Excel VBA issues please post in the Excel developer forums.

February 13th, 2014 12:11pm

Sorry I am new to forums.  I used the script on the forum page: http://social.technet.microsoft.com/Forums/en-US/57d8995e-49c0-43af-a637-6102a49a4df1/batch-script-to-open-multiple-excel-and-doc-files?forum=ITCG

strComputer="."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFileList = objWMIService.ExecQuery _
    ("ASSOCIATORS OF {Win32_Directory.Name='C:\test'} Where ResultClass = CIM_DataFile")

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = TRUE
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
For Each objFile In colFileList
    If objFile.Extension = "xls" Or objFile.Extension = "xlsx" Then
        objExcel.Workbooks.Open objFile.Name
    ElseIf objFile.Extension = "doc" or objFile.Extension = "docx" Then
        objWord.Documents.Open objFile.Name
    End If
Next

This opened all my .xls files in C:\Test folder, and using same code with Close I can close them all too.  I want to save each as a text file, before closing.  That way I can sort all the .txt files together.  As it is now, I open the .xls , SaveAs text, close, repeat.  

Free Windows Admin Tool Kit Click here and download it now
March 26th, 2014 4:00pm

http://blogs.technet.com/b/heyscriptingguy/archive/2004/12/22/how-can-i-save-word-documents-as-text-files-by-using-a-script.aspx

March 26th, 2014 4:15pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics