vba save as pdf - stretched image

crazydragon84

Board Regular
Joined
Feb 19, 2015
Messages
195
Hi,

I have a sheet that has multiple pictures (actually a snapshot using the camera tool from other sheets in the workbook) in a sheet. When I hit F12 and save as PDF, the PDF file looks fine. Now, I do the same thing with the macro and use ExportAsFixedFormat, all the images are stretched in the PDF. I thought maybe this was Printer Setup issue (Excel saves images slightly differently when you select different printers as default printer), so I added Application.ActivePrinter to the code to set the appropriate printer as well. It worked twice, then it went back to stretched image again (after opening another file?). Any idea about what is causing this issue and a workaround? Here is my code:

Code:
Sub Print_to_PDF()

Dim STDPrinter As String


If Sheets("FINAL").Visible = False Then Sheets("FINAL").Visible = True
STDPrinter = Application.ActivePrinter
Application.ActivePrinter = "Printer Name Here"


Sheets("FINAL").ExportAsFixedFormat Type:=xlTypePDF, Filename:=Range("abc"), Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True




Application.ActivePrinter = STDPrinter
End Sub
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
sorry I don' t have an answer - I have the same problem! I resorted to shrinking the picture in my sheet to where it was roughly the right size on the resulting PDF. would be interested in solving it properly though.
 
Upvote 0
for me, the size of the picture isn't the issue. the size is correct, but the text inside gets stretched sideways, short and fat. I can't use a textbox instead because these are tables of data that changes each time the reports are ran. the crazy thing is I have a different template that is doing exactly the same thing for a different report and it doesn't have the same issue...
 
Upvote 0

Forum statistics

Threads
1,214,804
Messages
6,121,652
Members
449,045
Latest member
Marcus05

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