VBA, Graph not saving as the correct size on A1 Page.

raven_squire

Board Regular
Joined
Jan 13, 2013
Messages
99
Hello,
I am working with lots of graphs and the page size is A1 (too many data points to display on A4 with the lowest marker size of 2).

I can save one graph manually as PDF and everything displays fine on the PDF.

If I save one with vba using recorded code the graph on the pfd displays at 1/9th of the page size in the top left hand corner, allmost as though the graph reverted to a4 in size (A4 is 1/8th the size of A1).

'******This is how I set up my chart
Charts.Add Before:=Worksheets(Worksheets.Count)

'Page Setup
Application.PrintCommunication = False
With ActiveChart.PageSetup
.Orientation = xlLandscape
.PaperSize = 164
End With
Application.PrintCommunication = True

'****** This is how I save the chart as PDF
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
Environ("USERPROFILE") & "\Desktop\My Graphs" & MonthYear & "" & ChartXtitle & ".PDF", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
'******

I don't understand the relationship between the graph and the page as there is no worksheet.
I don't understand the relationship between the worksheet size, the print size and the graph size


If anyone could elaorate or assist it would be apreciated.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
So after some playing around I discovered that if I changed the graph to an embeded graph on a spread sheet and then changed the size of the graph that it would save as a pdf and retain the correct size.
 
Upvote 0

Forum statistics

Threads
1,214,522
Messages
6,120,022
Members
448,939
Latest member
Leon Leenders

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