Sheet SaveAs PDF containg a chart (the chart does not show the legend...)

drom

Well-known Member
Joined
Mar 20, 2005
Messages
521
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Hi and thanks in advance!

I am saving a sheet X in a new Workbook using a looping, calculate... as:
  • a new workbook containing only 1 Sheet
  • a new PDF file (just a replica of the saved excel file, sheet)
This works Fine.
I use:

VBA Code:
Dim WKBvba As Workbook:           Set WKBvba = ThisWorkbook 'Name of the workbook you are copying from

                                    Workbooks.Add 1 'adds new workbook containing 1 sheet
Dim WKBnew As Workbook:             Set WKBnew = ActiveWorkbook
  WKBvba.Sheets(wsPtReport).Copy Before:=WKBnew.Sheets(1)
  WKBnew.Sheets(2).Delete
      ActiveSheet.Calculate 'In case...
    Cells.Copy
    Cells.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
'I do a few more things, like delete non desired Shapes, named ranges etc...
    
    ActiveSheet.ExportAsFixedFormat _
        Type:=xlTypePDF, _
        Filename:=wFxFNpdf, _
        Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, _
        IgnorePrintAreas:=False, _
        OpenAfterPublish:=False
    If WKBnew.Sheets.Count <> WKBvba.Sheets.Count Then     'My model contains many sheets, the Worksheet, only 1, this is why I use this as Stop any crash (a way to stop saving my model with a new name)..
        WKBnew.SaveAs Filename:=wFxFNxls, FileFormat:=xlWorkbookDefault
        WKBnew.Close False
    End If
wFxFNpdf = is the Fullname I use for my new created PDF file
wFxFNxls = is the Fullname I use for my new created Excel file

My Problem:
The sheet contains a Chart and this chart comes with No Category labels, No Legend (everything else comes OK in my new created PDF file (check this photo) :

1632006173799.png

While in my new Excel file I get:
1632006274096.png

So I do not know Whats wrong ??
Why the :
  • Category labels comes Black
  • Legend comes Black 'this Legend has No Formula
When I open the new created excel file, (comes perfect, with everything OK, comes as it should)
But the PDF shows everything OK, except the chart legend and category labels WHY ??
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,213,504
Messages
6,114,016
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top