Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6668135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:00:28+00:00 2026-05-26T03:00:28+00:00

I work on an excel script that creates powerpoint slides. On a powerpoint slide,

  • 0

I work on an excel script that creates powerpoint slides.
On a powerpoint slide, I want to show the legend of a chart, but not the rest of the chart.

Here is an excerpt of my code:

With Sheets("data")
    Set bereich = Range(.Cells(Daty + 1, 3), .Cells(Daty + 2 + UBound(SubCategories), Datx + UBound(anzahl, 1)))
    Set dia = .ChartObjects.Add(10, 800, 650, 400)
   .ChartObjects(dia.Name).Activate
   dia.Name = "ideaspersubcatstatus"       
   .Shapes(dia.Name).Left = Range(.Cells(intSubCat + 3, 1), .Cells(intSubCat + 3, 1)).Left
   .Shapes(dia.Name).Top = Range(.Cells(intSubCat + 3, 1), .Cells(intSubCat + 3, 1)).Top
End With
With ActiveChart
    .ChartType = xlBarStacked
    .SetSourceData Source:=bereich, PlotBy:=xlColumns
    .HasLegend = True
    .PlotArea.Interior.ColorIndex = xlNone
    .Axes(xlCategory).TickLabelSpacing = 1
    .ChartArea.Border.LineStyle = 0
    .Axes(xlValue).MajorGridlines.Border.LineStyle = xlDot
End With

I either need to copy the legend of the graph to powerpoint, or remove everything but the legend from the chart before I copy it to Powerpoint.

    With .Slides(9)
        'copy graph from Excel
        Workbooks("data.xls").Worksheets("data").ChartObjects("ideaspersubcatstatus").Copy
        'paste graph into Powerpoint
        .Shapes.Paste        
    End With

“.PlotArea.Delete” is not supported. “.ChartObjects(1).Legend.Copy” did not work, either.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:00:29+00:00Added an answer on May 26, 2026 at 3:00 am

    I don’t think you can copy only the legend, or delete the plot area — or delete all of its contents (series) without the legend disappearing.

    What you can do is make the plot area really small, and hide it behind the legend:

    With ActiveChart
        .Axes(xlCategory).Delete
        .Axes(xlValue).Delete
        .PlotArea.ClearFormats
        .Axes(xlValue).MajorGridlines.Delete
        ' Make it small
        With .PlotArea
            .Width = 0
            .Height = 0
        End With
        ' Move the legend on top of it
        With .Legend
            .Left = 1
            .Top = 1
        End With
    End With
    

    If you want, you can then reduce the size of your Chart area so that it fits snuggly around the legend.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a series of big excel files that work like a program, but
can anyone tell me why this does not work Excel.Worksheet ws_res = (Excel.Worksheet) wb.Worksheets.Add(mis,
At work we've got a roster that's historically been maintained in a huge Excel
I have the this code that will create excel file and work sheet then
I have a request for some contract work from an organization that uses Excel
we use an application that has an export to excel feature that doesn't work
I tried using a free script that I found on the Internet but it
How I can work with Excel 2007 and Excel 2003 (Excel Chart) from win32
I have an Excel document (2007) with a chart (Clustered Column) that gets its
I have created a php script that reads an excel sheet of thousands of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.