kerberos1
November 10th, 2003, 10:59 AM
Does anybody know how to access the MS Excel textfile assistant from c++ 6.0?
|
Click to See Complete Forum and Search --> : Excel textfileassistant kerberos1 November 10th, 2003, 10:59 AM Does anybody know how to access the MS Excel textfile assistant from c++ 6.0? Tom Frohman November 10th, 2003, 03:56 PM My problem with this is that though I have used Excel extensively and automated it from VC, I have never heard of "textfile assistant" and find no reference to it in Excel's help. Are you sure that it is called this? Could you describe what it is supposed to do? kerberos1 November 11th, 2003, 12:59 AM I am using a german excel. It appears when opening a File of type *.txt. What I need ist the Dialog which allows to select seperators or if it was a fixed format textfile, etc. Further you can select or deselect columns and so on. To me it looks like the dialog offers all the features one can expect from a text file import so I'd like to use it. Thanks a lot. Tom Frohman November 11th, 2003, 06:51 AM Okay, I know that one as the OpenText method when using Automation such as http://www.codeguru.com/forum/showthread.php?s=&threadid=240169&highlight=OpenTex%2A Try searching the visual C++ forums for OpenTex* kerberos1 November 13th, 2003, 03:41 AM Hello Tom, the OpenText works fine, but it doesn't meet my needs. I've bin trying to access the dialog. My goal is to provide the user the dialog to specify the struktur of the text file. Do you have any suggestion about that? Thanks a lot HJF Tom Frohman November 13th, 2003, 08:25 AM The following worked for me: _Application app; Workbooks books; if (!app.CreateDispatch("Excel.Application")) { AfxMessageBox("Couldn't start Excel."); return; } app.SetUserControl(TRUE); app.SetVisible(TRUE); books =app.GetWorkbooks(); Dialogs dlgs; Dialog dlg; dlgs=app.GetDialogs(); dlg=dlgs.GetItem(1); dlg.Show(COleVariant("d:\\junk.txt")); I overloaded the show method in my excel9.cpp file and excel9.h file as follows BOOL Dialog::Show(const VARIANT& Arg1) { BOOL result; static BYTE parms[] =VTS_VARIANT; InvokeHelper(0x1f0, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,&Arg1); return result; } and BOOL Show(const VARIANT& Arg1); to get rid of the other 29 arguments of show. I couldn't get it to work for the open text dialog but when it sees that the file is not an excel file in the open dialog it uses the text wizard to import the file. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |