>I'm having the toughest time figuring out how to merge cells , allign cells (i.e center the text in a merged cell) and create a new worksheet to an existing spreadsheet in excel using Ole automation. Does anyone have any suggestions ?
>Also Does anyone have an example of how the excel header file (Excel.h in your files section ) is used. I dont quite understand when and how to use the constants.
>Is there any documentation/ book that makes more than a passing reference to this OLE stuff--- for a beginner to OLE automation ?
>
>
>Thank you in advance
>Brian
When you wan tto accomplish something in Word or Excel by OLE automation, it is best to first record a macro in that program, and the edit the macro in the VBA editor (Tools->Macros->VBA Editor) to see what was generated. YOu can then see the names of the funtions and the values of parameters that need to be passed to accomplish your task. But the generated code is VBA and not VFP, so some translation is in order. First thing you'll notice is that the parameters are named, and VFP paramaters are ordered. You need to press F2 in the VBA editor to open the VBA object browser. Type in the name of the function you will be using, and right click on the correct function in the list, and choose help to get to the help topic for that function. THere, oyu can see the order in which the parameters should be passed.
When you saw the generated macro code, you saw the constants you were asking about being passed. You don't need to use these constants, you can use literals instead- to find the literal value of one of the constants use in Excel or word, just type its name in the object browser and look at the value at the bottom of the screen.
If you need basic examples of how to start the Excel object, look in the solutions app that ships with VFP, under OLE automation samples.
Erik Moore
Clientelligence