Results 1 to 2 of 2
  1. #1
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,826
    Thanks
    136
    Thanked 482 Times in 459 Posts

    Re: Legend (Height, Top) (Excel 2003 (but all?))

    Hi Chris

    Thanks for sharing that.
    These little things are important and can save others a lot of head scratching.
    I have mentally filed that tip away.

    zeddy

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Legend (Height, Top) (Excel 2003 (but all?))

    <P ID="edit" class=small>(Edited by chrisgreaves on 20-Feb-09 09:11. Added comments on .Left, .Width, Word, PPT)</P>See also <post#=278,064>post 278,064</post#>

    This had me stumped, but was resolved by a second cup of coffeeeeeee!

    <pre> With .Chart.Legend
    .Left = app.dblLegendLeft
    .Top = app.dblLegendTop
    .Height = app.dblLegendHeight

    .Width = app.dblLegendWidth
    .AutoScaleFont = False
    .Font.Name = app.strFontFace
    .Font.Size = app.dblFontSize
    End With</pre>

    wasn't applying the .TOP correctly.
    <pre> With .Chart.Legend
    .Left = app.dblLegendLeft
    .Height = app.dblLegendHeight
    .Top = app.dblLegendTop

    .Width = app.dblLegendWidth
    .AutoScaleFont = False
    .Font.Name = app.strFontFace
    .Font.Size = app.dblFontSize
    End With</pre>

    Works!

    Probable reason (and may apply to many other shape objects, not just in charts): The HEIGHT I had set would have caused the legend box to overflow the bottom of the chart area, so Excel set TOP to be ChartArea.Height MINUS Legend.Height, rather than using my supplied .TOP value.

    (next day)
    Probably also applies to .Left and .Width.
    Probably also in many other graphical situations, Word GUI forms, Powerpoint slides etc.

Posting Permissions

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