How does one build a spreedsheet using the OpenText function?

sidero

New Member
Hi! I'm new to OLE-Automation and I would like to know how the OpenText function is used in order to read in a File with semicolon seperated data to create a new spreedsheet.

I have tried the COM Object viewer and got the following information:
Method with 16 arguments, 11 optional:
NO-RETURN-VALUE com-handle: OpenText (
Character-Filename,
anytype-Origin,
anytype-StartRow,
anytype-DataType,
Integer-TextQualifier,
anytype-ConsecutiveDelimiter,
anytype-Tab,
anytype-Semicolon,
anytype-Comma,
anytype-Space,
anytype-Other,
anytype-OtherChar,
anytype-FieldInfo,
anytype-TextVisualLayout,
anytype-DecimalSeparator,
anytype-ThousandsSeparator ).

Huh???????????? so which 5 are not optional, and what does anytype-xxx mean??????????????

Can anybody please tell me what's wrong with this statement:

chExcelApplication:Workbooks:OpenText("c:\Test.txt",2,"Semicolon",,,,TRUE).

.....Thank you

Oliver
 

Matthew Scott

New Member
sidero,

This is what I came up with:

DEF VAR chExcel AS COM-HANDLE.

CREATE "excel.application" chExcel.

chExcel:Visible = True.

chExcel:Workbooks:OpenText("c:\test.txt",,1,,,,,"true").

The '1' refers to the row number of your text file you start from, and the 'true' means that you are using semicolon as a delimeter. Check out the help files in the VB editor in Excel for more details.

By the way, 'anytype' is probably the same as the 'variant' data-type in VB.

Hope this helps.
 
Top