Results 1 to 7 of 7

Thread: Excel Line Color??

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Excel Line Color??

    Yes, yet another thread on Excel 2007/VS 2008/VSTO. I simply cannot change the line color on my charts. The below changes all work except the forecolor and backcolor properties. It loops through the series collection, setting the series line properties. What am I doing wrong??
    Code:
    MySeriesColl = MyChart.SeriesCollection 'required or else second series overwrites first one?
            For Each MySeries As Excel.Series In MySeriesColl
                MySeries.Format.Line.DashStyle = Microsoft.Office.Core.MsoLineDashStyle.msoLineSolid
                MySeries.Format.Line.Weight = "1"
                MySeries.Format.Line.Style = Microsoft.Office.Core.MsoLineStyle.msoLineSingle
                MySeries.Format.Line.ForeColor.RGB = Drawing.Color.Black.ToArgb
                MySeries.Format.Line.BackColor.RGB = Drawing.Color.Black.ToArgb
            Next
    P.S. Should these threads be moved to the .NET forum? Or keep them here...

  2. #2
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Excel Line Color??

    Does this help?

    'Please change values in the bracket for the resp color
    MySeries.Format.Line.ForeColor.RGB = RGB(255, 127, 0)

    Same for the backcolor...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: Excel Line Color??

    No, that still has no effect. No matter what I try, that property doesn't seem to do anything.

  4. #4
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Excel Line Color??

    Try This in your code in this sequence

    MySeries.Border.Color = RGB(255, 127, 0)
    MySeries.Format.Line.ForeColor.RGB = RGB(255, 127, 0)
    Last edited by Siddharth Rout; Apr 8th, 2008 at 01:32 PM.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: Excel Line Color??

    There is no Border property of the Excel.Series interop object in .NET

  6. #6
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Excel Line Color??

    Quote Originally Posted by gigemboy
    There is no Border property of the Excel.Series interop object in .NET
    Strange?
    http://technet.microsoft.com/en-us/l.../cc179160.aspx

    Border property has to be there for charts be it excel 97 or 2003 or 2007. (i could be wrong)
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  7. #7
    Addicted Member
    Join Date
    Jul 2012
    Location
    Wiltshire, England
    Posts
    211

    Re: Excel Line Color??

    An old thread, but this has just worked for me - I'm looping through all the series and setting the colour depending on which series:

    Code:
    Select Case .SeriesCollection.count
                            Case 1
                                .SeriesCollection(.SeriesCollection.count).border.color = Microsoft.Office.Interop.Excel.XlRgbColor.rgbRed
                            Case 2
                                .SeriesCollection(.SeriesCollection.count).border.color = Microsoft.Office.Interop.Excel.XlRgbColor.rgbBlack
                            Case 3
                                .SeriesCollection(.SeriesCollection.count).border.color = Microsoft.Office.Interop.Excel.XlRgbColor.rgbGreen
                            Case 4
                                .SeriesCollection(.SeriesCollection.count).border.color = Microsoft.Office.Interop.Excel.XlRgbColor.rgbBlue
                        End Select

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width