VBA: Excel chart - Changing apperance of series in scatter plot: vba-function for implementing "marker border" and "line" are overlapping

Anonym
2023-06-15T14:45:17+00:00

Edit:

*Found solution (finally after many months). See my reply to Soenu further down (and thank you for your effort Soenu).

Hello,

Whenever I change the apperance of series (in a scatter plot) to include "marker border", a solid line is also included. However, I only want the marker border...

This seems to be an error in the in-built vba-function with "a property"/"an attribute" overlapping two actual "functions" - resulting in "two outputs."

Can you please fix this.

The in-built vba-function is

ActiveChart.FullSeriesCollection(1).Format.Line.Visible = msoTrue

There is a similar issue with the vba-function "ActiveChart.ChartType = xlColumnStacked", which is not fixed, however there is a workaround in this page: https://answers.microsoft.com/en-us/msoffice/forum/all/cannot-get-correct-type-of-chart-through-vba-code/ef57be1a-fab5-42a9-8d18-4af79e0cd5b2. These kind of errors are quite bad and should be fixed. - Regards Hallvard

Microsoft 365 og Office | Excel | Annet | Windows

Låst spørsmål. Dette spørsmålet ble overført fra Microsofts kundestøttefelleskap. Du kan stemme på om det er nyttig, men du kan ikke legge til kommentarer eller svar eller følge spørsmålet.

0 kommentarer Ingen kommentarer

3 svar

Sorter etter: Mest nyttig
  1. Anonym
    2023-06-16T14:55:43+00:00

    Hi Hallvard S!

    Thank you for the feedback.

    I'm sorry, unfortunately, I don't have any further troubleshooting to offer.

    There are many knowledgeable users active on the forum and I hope that someone else can offer further insight into your issue.

    Kind Regards, Shakiru

    Var dette svaret nyttig?

    1 person syntes dette svaret var nyttig.
    0 kommentarer Ingen kommentarer
  2. Anonym
    2023-06-15T15:50:49+00:00

    Thank you,

    I tried it but it didn't work,

    however, I have searched this a bit again and now I found something that works - thanks to these guys (link1, link2 and link3):

    ActiveChart.SeriesCollection(14).Select 
    
    With Selection
    
        .Border.LineStyle = xlContinuous 
    
        .Border.Color = RGB(255, 0, 0)  'Gives only the line (also called border) a colour
    

    .Border.ColorIndex = -4142 ' Makes the line disappear (Note that this needs "Colorindex" not Color - It's a "discrepancy")

        .MarkerBackgroundColor = RGB(255, 255, 255) '-2
    
        .MarkerForegroundColor = RGB(0, 0, 255) '-2
    

    End with

    The to latter lines gives colours to the fill and the border of the marker and the input "-2" (instead of some RGB-code) makes them dissappear too.

    Now a second problem, if I want to edit the marker border size, it's a bit cumbersome:

    .Format.Line.Weight

    will change both line and marker border.

    However it is possible to then change the line only (border only):

     .Border.Weight 'But this works strangely with the input - Found at (link4)
    

    I haven't found a similar property only for the marker border.

    Var dette svaret nyttig?

    0 kommentarer Ingen kommentarer
  3. Anonym
    2023-06-15T15:27:31+00:00

    Hi Hallvard S!

    I am Shakiru, an independent advisor and a user like you, and I am glad to be helping you out today.

    Please try using the MarkerBorder property written below

    ActiveChart.FullSeriesCollection(1). MarkerBorder.Visible = True

    This code will enable the marker border for the first series in the chart without affecting the line connecting the markers.

    Make sure to adjust the series index (currently set as 1) according to your specific scenario. If you have multiple series and want to modify a different series, you can change the index accordingly.

    Kindly let me know, if you require additional assistance, I will be glad to help further.

    Best Regards, Shakiru

    Var dette svaret nyttig?

    0 kommentarer Ingen kommentarer