Click to See Complete Forum and Search --> : Office automation documetation


pat
September 3rd, 1999, 03:05 AM
I've tried to find documentation on office automation in particular now for excel, but i've don't find very good document.

In particular I don't find document on function argument.

Example :

If i want modify style of group of cell i don't know what value i must to submit to function SetHorizzontalAlignement see:

range = sheet.GetRange(COleVariant((LPCSTR)csFirstCell), COleVariant((LPCSTR)csLastCell));
style = range.GetStyle();
style.SetHorizontalAlignment( what is a value that i must insert ???????);

I have found only documentation in help format only for VB but don't for VC++. I've also Msdn library, but there isn't so much.

Can u help me

Thanks

Dyensì Software
Antonio Patarozzi

September 3rd, 1999, 08:52 AM
You're right...there is not much documentation.
However, you can use the VB help to get the values of the constants passed to the functions. If you open the Visual Basic Editor from Excel (from Excel menu: Tools, Macro, Visual Basic Editor), and then use the Object Browser (from Visual Basic Editor menu: View, Object Browser) to search for the function.

Referring to your example, in the Object Browser type Style as the keyword for the search, or just scroll to find Style in the Classes pane and click on it. The Horizontal Alignment property will be listed as a Member of 'Style'. If you click on HorizontalAlignment in member of 'Style' pane, you will notice in the bottom pane, it reads:

Property HorizontalAlignment As XlHAlign
Member of Excel.Style

where XlHAlign is a link. If you pass the mouse over it, it becomes a hand, so click on XlHAlign, and the Object Browser will jump to XlHAlign with all its members.
The members listed are the constants that may be used for the HorizontalAlignment property. So, if you want the alignment to be centered say (xlHAlignCenter), click on xlHAlignCenter in the Members of 'XlHAlign' pane. Again, notice the bottom pane. It now reads:

Const xlHAlignCenter = -4108 (&HFFFFEFF4)
Member of Excel.XlHAlign

So '-4108' is the value you need to put into the function.
Your code would then look like:

range = sheet.GetRange(COleVariant((LPCSTR)csFirstCell), COleVariant((LPCSTR)csLastCell));
style = range.GetStyle();
style.SetHorizontalAlignment(COleVariant((short)-4108)); //xlHAlignCenter = -4108



Good luck...hope that helps.

pat
September 3rd, 1999, 09:39 AM
thanks for your answer.

But microsoft cannot create also a .h files with this costants when she create interface classes for excel ?????

A time i don't understand the filosophy of microsoft.

Thanks again and sorry for my english.

Thanks

Dyensì Software
Antonio Patarozzi