Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Excel.Style object: Border problems

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.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
border colors and style ralf Excel Discussion (Misc queries) 7 January 17th 10 04:36 PM
Change border style using VB Dbl_Planker Excel Discussion (Misc queries) 0 September 24th 09 10:18 PM
Create new border style? alexmoss Excel Discussion (Misc queries) 6 February 9th 09 03:18 AM
Excel 2003 List does not preserve border style for all rows Geetha Excel Discussion (Misc queries) 0 August 16th 06 07:22 PM
Border style of Excel forms Shu Excel Programming 3 April 29th 04 12:33 PM


All times are GMT +1. The time now is 10:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"