I’m trying to save a single worksheet from a workbook as a pdf using the ExportAsFixedFormat method:
Sheets("Overview").ExportAsFixedFormat Type:=xlTypePDF, _ Filename:=Mid(saveFile, 1, InStr(saveFile, ".")) & "pdf", _ Quality:=xlQualityStandard, IncludeDocProperties:=True, _ IgnorePrintAreas:=False, OpenAfterPublish:=False
This worked for a while until i started doing some chart manipulation beforehand. The manipulation I am talking about looks like this:
ActiveSheet.ChartObjects("Diagramm 4").Activate ActiveChart.SetSourceData Source:=Sheets("Measurements").Range( _ "C4:C29,G4:G29")
Now its not exporting the whole sheet as a pdf but rather only the chart called “Diagramm 4”.
I more or less understand why it’s doing this but I can’t find a way to fix this.
You could try selecting any cell on that sheet like:
before you export the page. Likely this is happening because you’re making the chart active without making it inactive again. Look what happens when you normally select a chart and then try to print a worksheet – it’ll just try to print the chart.