Re: The regular yell of horror.
On Mar 23, 9:27 am, Stuart Redmann <DerTop...@web.de> wrote:
Hi folks,
it's time again for me to write down some of my experiences with MS software.
Let's set the scene: I'm trying to write a small example application that uses
Excel Automation. As I don't like to use MFC for this, I do it the ATL way,
importing xl5en32.olb for type information in my project. So far, so good. As my
sample project evolves I get to a point where I want to access a single cell of
a Excel worksheet,
Excel::RangePtr spRange = spWorksheet->Range ("A1");
So no apparent reason this call fails every time with "DISP_E_MEMBERNOTFOUND
Member not found". After two hours (which costs my boss 130 Euro, or about 170
Dollar) I finally find that the compiler generated .tli file is buggy:
#pragma implementation_key(1092)
inline _variant_t Excel::Worksheet::Range ( const _variant_t & Cell1, const
_variant_t & Cell2 ) {
VARIANT _result;
_com_dispatch_method(this, 0xc5, DISPATCH_METHOD, VT_VARIANT, (void*)&_result,
L"\x080c\x080c", &Cell1, &Cell2);
return _variant_t(_result, false);
}
The third parameter to _com_dispatch_method should be DISPATCH_METHOD |
DISPATCH_PROPERTYGET instead of DISPATCH_METHOD. For some reasons I cannot
simply correct this in the .tli file as the IDE keeps generating this file at
certain intervalls (about every 5 seconds, but only, and now please button back
your ears, if the mouse pointer or the cursor hovers over the import statement
in my source code). The only solution is to exchange the import by an include of
the .tlh header.
Googling the web or searching the MSDN site yields nothing. I don't want to
appear paranoid, but I think that MS has made quite some effort to let any web
site disappear that connects the words "Microsoft" with "bug list".
Having solved this puzzle, it went on doing the work I actually wanted to do.
Pretty soon I discovered that you can only select cells of an Excel worksheet by
giving a _string_ which contains the address of the cell in A1 notation. This
looks like the most obscure thing to me as I expected that accessing a single
cell could be done by supplying two integers for the row and the column of the
cell. As things are, I have to write some transformation function which takes
two integers and returns the A1 notation as string. MS may have done things
worse, but I think this would have called for more geniality.
Phew, it was good to get this one off my chest.
Have a nice weekend,
Stuart
It will help if you post this in a Excel/Office automation newsgroup.
Also .tli file is not generated automatically. You will probably be
doing some compilation in order for that to happen. If your issue is
resolved by chaning .tlh etc, by all means do that and simply copy it
over from a location in post build step. We did something on those
lines for some other server.
---
Ajay