Thanks for clarifying this. I posted on another group this exact problem.
The weird thing for me is that the Range.Border values, xlEdgeLeft ... ,
worked for me with Styles until Excel 2007.
--
EB
"Peter T" wrote:
have you tried simply (from you earlier code) -
Excel.Borders borders = myStyle.Borders;
borders[Excel.XlBordersIndex.3].Color = 0x00ff00;
or
borders[Excel.XlBordersIndex.xlTop].Color = 0x00ff00;
not sure if your object name 'borders' is causing any confusion
Regards,
Peter T
"snoriidr" wrote in message
...
After working on a different issue for a bit, I finally stumbled across
some
borders information that was a bit more clear in what was being explained.
This may have been overlooked because I was developing in C#.
I have to say that there is no documentation in msdn that declares that
the
Borders collection is different in Range vs. Style. In the documentation
it
simply states that you would access the borders via the
Excel.XlBorderIndex.
However as was found in a different article:
http://forums.microsoft.com/MSDN/Sho...47692&SiteID=1.
There
are a different set of values that should be accessing the Borders
collection
for a more consistent outcome. This would never have occurred to me. But
in
reviewing the code snippets in this thread, there are 2 different sets of
constants. However it was not clear since in C# Excel.XlBorderIndex is
the
expected parameter to gain access to the borders collection.
The document explicitly uses another set of constants: Excel.Constants
Aside from this article is there any additional documentation as to when
to
use these vs. the Excel.XlBordeIndex??? Geez.. I'm just lucky I happened
upon
the little article.
Well in a nutshell, they cast the Top, Bottom, Left and Right enumerations
that come from Excel.Constants to be Excel.XlBorderIndex enumerations.
So here's some code that might help future inquries in this area:
Excel.XlBorderIndex topIndex = (Excel.XlBorderIndex)Excel.Constants.xlTop;
Excel.XlBorderIndex bottomIndex =
(Excel.XlBorderIndex)Excel.Constants.xlBottom;
Excel.XlBorderIndex leftIndex =
(Excel.XlBorderIndex)Excel.Constants.xlLeft;
Excel.XlBorderIndex rightIndes =
(Excel.XlBorderIndex)Excel.Constants.xlRight;
Hope this helps others who might come across this problem.
This is a WORKAROUND, but why is there such a lack in documentation
regarding that difference?? Go figure. I'm just glad I found a solution.