 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Paul Guest
|
Posted: Wed Sep 08, 2004 3:18 pm Post subject: Opening a text file with Excel |
|
|
Hi
I'm trying to open a csv file using Excel OleAutomation from within Delphi.
I can open the text file, but within the Worksheet things like the telephone
number all drop the 0 at the front e.g. 01221 111111 becomes 1221 111111.
The way around this is to set the FieldInfo parameter in the OpenText
procedure.
The way to do this is to pass an array of arrays, I can find VB examples
which show FieldInfo:=Array(Array(1,2),Array(2,3)).... etc etc. But I can't
find the equivalent Delphi examples.
In the Delphi call FieldInfo is a OleVariant. I've tried the following code
but it does not work.
var
dataType : OleVariant
begin
dataType := VarArrayCreate([1,173], varVariant); //Creates a 173
array element of variants
dataType[31] := VarArrayOf([31, 3]); //Adds an
array at element 31 to create a Date of Birth Field at Column 31
end;
The dataType variable is then passed in the OpenText procedure instead of
the usual EmptyParam
I get the following error
OLE error 800A03EC
Can anyone point me in the right direction please.
Paul
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|