Page 1 of 1 1
Topic Options
#84747 - 2001-12-28 09:50 PM KIXTART/XL2000: Workbooks.Open Parameters?
azure Offline
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
#84748 - 2001-12-28 10:51 PM Re: KIXTART/XL2000: Workbooks.Open Parameters?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
hi Jim,

Try this:

$oXL.WORKBOOKS.OPEN("C:\UPLOAD\CHARTING15.TXT",,,6,,,,,"*")

-Shawn

Top
#84749 - 2001-12-28 10:56 PM Re: KIXTART/XL2000: Workbooks.Open Parameters?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Oh yeah, Jim, thought you might find this link helpfull:

Open Method


-Shawn

Top
#84750 - 2001-12-31 08:12 PM Re: KIXTART/XL2000: Workbooks.Open Parameters?
azure Offline
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
#84751 - 2001-12-31 08:54 PM Re: KIXTART/XL2000: Workbooks.Open Parameters?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Jim,

You mean, enumerate a bunch of xls files in a directory and merge them into one workbook (single xls file) ?

-Shawn

Top
#84752 - 2002-01-01 04:10 AM Re: KIXTART/XL2000: Workbooks.Open Parameters?
azure Offline
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 Offline
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
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2312 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.051 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org