I like to export 2 columns from a .xls file to a txt.
Let say column C and D. Im also trying to seperate them with a _. The .xls have several sheets and I only need data from one of them. How do you accoplish that?
This is what I have so far. I have never done anything like this before and I honestly dont know what I am doing rihgt/wrong. I get all kinds or errors and haveing a hard time figure vbs out.
Dim saveDir
set fso = CreateObject("Scripting.FileSystemObject")
set shell = CreateObject("WScript.Shell")
set objExcel = CreateObject("Excel.Application")
Set objArgs = WScript.Arguments
Set fso = CreateObject("Scripting.FileSystemObject")
set top = fso.GetFolder(shell.CurrentDirectory)
DirBase = top & "\" & "jipCOPY" & "\"
Set objExcel = CreateObject("Excel.application")
set objExcelBook = objExcel.Workbooks.Open(DirBase & "1.xls")
objExcel.application.visible=false
objExcel.application.displayalerts=false
Set puCols = objExcel.Range("C13","C15")
Set poCols = objExcel.Range("D13","D15")
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("jipDATA.txt", ForWriting)
objFile.WriteLine puCols & "_" & poCols
objFile.Close
objExcel.Application.Quit
objExcel.Quit
Set objExcel = Nothing
set objExcelBook = Nothing
I'm trying to do this with a .vbs executed from a .bat.
All code is taken from this site and I tried to mod it but I cant say that it is going the right direction. Any one who could help out a bit, point me in the right direction or any thing?