I'm trying to write some code to automatize pdf export of graphs contained in a workbook.
All my graphs have the same size (Height : 297mm and Width 210mm) and I'd like to export all of them to an unique pdf file with one graph per page. I am using the PrintOut function of the WorkbookItem class for that.
Unfortunately, I've got a warning message saying that the printed document has to be resized due to the printer configuration. In fact, the system automatically adds some margins of 1" to my graph so that the graph is shrinked in the resulting pdf.
Is there any way to control the margins when creating a pdf with PrintOut ?
I've tried to save the graph as pdf and in this case, there are no margins added but it is not possible to append new graphs to an existing pdf file. It's only possible to overwrite the file.
Thanks a lot for your help
If you have a workbook item named "wbi" which contains a graph
dim g as graph
set g = wbi.object
g.SetMargins(0, 0, 0, 0) ' value is in twips (1/20th of a point, 72 points per inch, 1,440 twips per inch)
wbi.Lock = false
That works fine !