none
Crossing the border >> Removing the border from an Excel chart RRS feed

  • Question

  • Hi
    I have a VB.Net program using VS2105 Pro.  I have successfully created a simple pie chart and everything works fine.  So that students can cut and paste the chart I wanted to remove the border.  So, I ran a macro in excel, removed the "line" border and looked at the recording which was:    ActiveSheet.Shapes("Chart 1").Line.Visible = msoFalse
    The only way I could get this to work was using the following format method:
    .ChartArea.Format.Line.Visible = Microsoft.Office.Core.MsoTriState.msoFalse
    This worked fine on my computer but another computer threw an error "Return argument has an invalid type".  Both computers are Windows 10 running Excel 2016.
    So I tried another approach which seems to work:
    .ChartArea.Border.LineStyle = Excel.XlLineStyle.xlLineStyleNone
    Well I know "if it works then it works" but I was thinking "if it works, is it right and is it reliable?"  Or is there a better way to remove a border which I have not yet found after a thorough trawl of the internet....
    Many thanks for any advice.
    Margarita

    Margarita_Cody

    Tuesday, March 29, 2016 4:25 PM

Answers

  • >>>Well I know "if it works then it works" but I was thinking "if it works, is it right and is it reliable?"

    Base on my testing and searching, .ChartArea.Border.LineStyle = Excel.XlLineStyle.xlLineStyleNone is right and reliable.
    • Marked as answer by Margarita_Cody Wednesday, March 30, 2016 7:49 AM
    Wednesday, March 30, 2016 7:22 AM