Home > database >  How to make double line chart not rounded in the end (how to change cap style)?
How to make double line chart not rounded in the end (how to change cap style)?

Time:10-27

When I create a line chart in Excel and change line style to double, I can see something similar to the image below:

enter image description here

As you can see the beggining and ending are rounded. I want to get rid of that, so it looks like this:

enter image description here

It can be done by changing line "cap type". I have tried exploring Series.Format.Line methods and properties but all I can do is modify beggining/ending arrows, there is no property/method for cap. I have also tried to use excel macro recorder to try and somehow expose this property/method but I have not been successful. I have also tried to search through various Excel/VBA forums but nothing helped.

Anyone able to help with my issue? I am looking for solution in VBA and VB.NET.

CodePudding user response:

It seems that this property is not exposed in VBA, so probably you are out of luck.

According to enter image description here

The (not so) funny thing is that the enumeration for the possible values is available in VBA:

enter image description here

CodePudding user response:

Try this sequence of formatting (example of formatting the first series):

    Dim testSeries As Series
    Set testSeries = ActiveChart.SeriesCollection(1)

    With testSeries.Format.Line
        .DashStyle = msoLineSquareDot
        .DashStyle = msoLineSolid
        .Style = msoLineThinThin
    End With
  • Related