>What I don't understand is where the documentation is that tells programmers >how to do these various tasks with the spreadsheet. The excel.h and excell.cpp >files certainly don't, they don't have any comments at all. Poking around got me >to this documentation: > >Microsoft Office Visual Basic for Applications Language References >I had hoped that I would be able to figure out the C++ code from the visual basic >documentation, but no such luck. For instance, the VB way to 'Open' a worksheet >is given as:
I'm not sure if the version of VBA reference you downloaded is the same, but I actually open up Excel itself, go to the VB editor, and invoke the help there. If I do that, the Open() method is described as: expression.Open(FileName, UpdateLinks, ReadOnly, Format, Password, WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable, Notify, Converter, AddToMRU) If you read further down, it tells you what each parameter should be, and whether they are optional or not. Since automation of such things is VB-like, parameters need to be wrapped in COleVariants - this is normally taken care of automatically for supplied parameters (hence why you don't have to wrap the string in one), but if you want to omit a parameter (imagine omitting a parameter to a C++ method that defaults to a value - you simply don't write it), you have to replace it with that rather horrid-looking covOptional monstrosity. Thus, think of the automation method as a method with lots of defaulted parameters, where you supply covOptional for any param you don't want to explicitly supply (not quite a true default, then). The only other thing to bear in mind is that most methods that create an object return that object as an LPDISPATCH. This is how you access the book thus opened, the worksheet grabbed, the range of cells extracted, etc. Where it becomes less intuitive is when you want to access what Excel considers a property of the object; e.g., the Font property of a Range (or Cell) object. For C++ they are always converted to something like GetFont() and there you really are stuck - in theory they take no parameters, but you can only look at the prototype in the H file to know that. I can't even remember whether it returns a CFont * or another LPDISPATCH. Did this help at all? If not, contact me offlist as I may be able to help a bit more. -- Jason Teagle [EMAIL PROTECTED] _______________________________________________ msvc mailing list msvc@beginthread.com See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription changes, and list archive.