Hi,
I have the following code sequences whose pourpose is to display a .txt file in a Excel Spreadsheet, however the .txt file is not being loaded after I execute workbooks.opentext
a workbook is loaded but there are no sheets displayed let alone text
I get good return codes from IDispatch->invoke and good return codes in excpInfo
I have changed the file name to a bogous name and the same thing happens
app.CreateDispatch("Excel.Application"); Workbooks objBooks(app.Workbooks());
Workbooks objBooks = app.GetWorkbooks();
COleVariant FilenameOpen(File),
FilenameSave(XlsFile),
Origin((short)2), StartRow((short)1),
DataType((short)1), TextQualifier((short)1), ConsecutiveDelimiter((long)FALSE, VT_BOOL),
Tab((long)FALSE, VT_BOOL),
Semicolon((long)TRUE, VT_BOOL),
Comma((long)FALSE, VT_BOOL),
Space((long)FALSE, VT_BOOL),
Other((long)FALSE, VT_BOOL),
Otherchar((long)FALSE,VT_BOOL),
Fieldinfo((long) FALSE, VT_BOOL),
TextVisualLayout((long)FALSE, VT_BOOL),
DecimalSeperator((long) FALSE, VT_BOOL),
ThousandSepartor((long) FALSE, VT_BOOL),
TrailingMinusNumbers((long) FALSE, VT_BOOL),
Local((long) FALSE, VT_BOOL),
Fileformat((short)33), Save((long)FALSE, VT_BOOL);
COleSafeArray saRet;
DWORD numElements[2];
numElements[0] = 2;
numElements[1] = 2;
saRet.Create(VT_I4,2,numElements);
long index[2];
long val;
index[0]=0;
index[1]=0;
val = 1;
saRet.PutElement(index,&val);
index[0] = 1;
index[1] = 0;
val = 2;
index[0] = 1;
index[1] = 1;
val = 9;
objBooks.OpenText((LPCTSTR)"C:\\Program Files\\Microsoft VIsual Studio\\MyProjects\\I46023\\I46023.txt", Origin, COleVariant((long)1),COleVariant((long)1),
1,
ConsecutiveDelimiter, Tab, Semicolon,
Comma,Space,Other,Otherchar,saRet,TextVisualLayout,
DecimalSeperator,ThousandSepartor,TrailingMinusNumbers,
Local);
app.SetVisible(true);
app.SetUserControl(TRUE);
|