OpenText in Excel for a semicolon-separated txt-file

grinder

Member
Hi,

I just want to open a TXT-file in Excel.
Here is how I am trying to do that:
Code:
  DEFINE VARIABLE chExcel   AS COM-HANDLE NO-UNDO.
  DEFINE VARIABLE cFileName AS CHARACTER  NO-UNDO.
  
  cFileName = fiFileName:SCREEN-VALUE IN FRAME {&FRAME-NAME}.
  
  CREATE "excel.application":U chExcel.
  
  chExcel:Workbooks:OpenText (
      /*<anytype>-FILENAME            */  cFileName ,
      /*<anytype>-Origin              */  ,
      /*<anytype>-StartRow            */  ,
      /*<anytype>-DataType            */  ,
      /*<anytype>-TextQualifier       */  ,
      /*<anytype>-ConsecutiveDelimiter*/  TRUE,
      /*<anytype>-Tab                 */  FALSE,
      /*<anytype>-Semicolon           */  TRUE,
      /*<anytype>-Comma               */  FALSE,
      /*<anytype>-Space               */  FALSE,
      /*<anytype>-Other               */  FALSE,
      /*<anytype>-OtherChar           */  FALSE,
      /*<anytype>-FieldInfo           */  ).
  
  chExcel:visible = TRUE.
  
  RELEASE OBJECT chExcel.
The text-file is separated by semicolons but Excel ignores the "Semicolon"-Parameter in the OpenText-method. Does anyone know how to do this? What do I do wrong?
 
Hi.

Try defining the DataType as xlDelimited (numeric value 1).

chExcel:Workbooks:OpenText (
/*<anytype>-FILENAME */ cFileName ,
/*<anytype>-Origin */ ,
/*<anytype>-StartRow */ ,
/*<anytype>-DataType xlDelimited */ , 1
/*<anytype>-TextQualifier */ ,
/*<anytype>-ConsecutiveDelimiter*/ TRUE,
/*<anytype>-Tab */ FALSE,
/*<anytype>-Semicolon */ TRUE,
/*<anytype>-Comma */ FALSE,
/*<anytype>-Space */ FALSE,
/*<anytype>-Other */ FALSE,
/*<anytype>-OtherChar */ FALSE,
/*<anytype>-FieldInfo */ ).
 
Top