#84747 - 2001-12-28 09:50 PM
KIXTART/XL2000: Workbooks.Open Parameters?
|
azure
Fresh Scripter
Registered: 2001-12-17
Posts: 14
Loc: Tampa, FL
|
I'm trying to open multiple * delimited text files in excel (as multiple workbooks). I'm trying to figure out how to open a file using * as a delimited file, and didn't find much help on msdn.code:
$Rc = $oXL.WORKBOOKS.OPEN(FILENAME:="C:\UPLOAD\CHARTING15.TXT",FORMAT:="6",DELIMITER="*")
Thanks in advance! Jim 
|
|
Top
|
|
|
|
#84750 - 2001-12-31 08:12 PM
Re: KIXTART/XL2000: Workbooks.Open Parameters?
|
azure
Fresh Scripter
Registered: 2001-12-17
Posts: 14
Loc: Tampa, FL
|
Thanks Shawn, It did the trick, and now I see how Kix handles passing variables to COM functions.I'm trying to take a directory of text files(logfiles created from one of my other scripts) and make them into something I can use for generating statistics on how long it takes the script to run on each machine. So i'm interfacing Kix with Excel a bunch now... i saw a post awhile back that involved creating Excel spreadsheets from Kix that is helping me a bunch. Another question I have is... can I take a bunch of spreadsheets and combine them into just one workbook with multiple worksheets?
|
|
Top
|
|
|
|
#84752 - 2002-01-01 04:10 AM
Re: KIXTART/XL2000: Workbooks.Open Parameters?
|
azure
Fresh Scripter
Registered: 2001-12-17
Posts: 14
Loc: Tampa, FL
|
Yes, that's what I mean.
|
|
Top
|
|
|
|
#84753 - 2002-01-04 01:56 AM
Re: KIXTART/XL2000: Workbooks.Open Parameters?
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
hi Jim,Here's a quick take on this - point $filepath to a directory containing many .xls files and have at it ... I purposefully just exited the script at the end just for debugging reasons, so it's not finished by any stretch ...
break on $filepath = "c:\xls" ; <- change this to point to a folder containing many .xls files
$xls = createobject("excel.application")
$xls.visible = 1
$wb1 = $xls.workbooks.add ; this is were we'll copy all our sheets
$filename = dir("$filepath\*.xls") ; start the enumeration while $filename and not @error $wb2 = $xls.workbooks.open("$filepath\$filename") ; open the workbook for each $worksheet in $wb2.worksheets $=$worksheet.copy($wb1.worksheets("sheet1")) ; copy the sheet to wb1 next $=$wb2.close $filename = dir() loop
; purposefully exit at this point without saving
exit 1
Hope this helps ! -Shawn
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 2312 anonymous users online.
|
|
|