ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   Legend Line Spacing (https://www.excelbanter.com/charts-charting-excel/33925-legend-line-spacing.html)

Bill Sturdevant

Legend Line Spacing
 
Is there a way in VB to force a legend to display in single line spacing
rather than what appears to be double line spacing?

I am using the following code to control the display of the legend. Is
there a property I can add that will control the line spacing?

ActiveChart.Legend.Select
Selection.AutoScaleFont = False
With Selection.Font
.Name = "Arial"
.FontStyle = "normal"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With


Andy Pope

Hi,

The line spacing is determined by Excel. It uses the size of the legend
box, legend text and number of entries to calculate the layout.
Unfortunately nothing useful is exposed in the object model to make
laying out the legend via code consistent.

To manually reduce the line spacing alter the height of the legend box.

Cheers
Andy

Bill Sturdevant wrote:
Is there a way in VB to force a legend to display in single line spacing
rather than what appears to be double line spacing?

I am using the following code to control the display of the legend. Is
there a property I can add that will control the line spacing?

ActiveChart.Legend.Select
Selection.AutoScaleFont = False
With Selection.Font
.Name = "Arial"
.FontStyle = "normal"
.Size = 9
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info


All times are GMT +1. The time now is 05:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com