remoel
remoel

Reputation: 175

Pasting image to chart through coding gets blurred

I am having a problem when pasting an image on a chart.

This is a cut sample of my code

ws.Paste
Set MyChart = wb.Charts.Add
MyChart.Name = "ImageChart"
Set MyChart = MyChart.Location(Where:=xlLocationAsObject, Name:=ws.Name)
MyChart.ChartArea.Width = ws.Shapes(1).Width
MyChart.ChartArea.Height = ws.Shapes(1).Height
MyChart.Parent.Border.LineStyle = 0 
ws.Shapes(1).CopyPicture xlScreen, xlPicture
MyChart.ChartArea.Select
MyChart.Paste

I am adjusting the height and width of the chart to be the same as the image and when it paste, it gets blurred. But when I am doing it manually, the quality of the image stays the same.

Upvotes: 1

Views: 399

Answers (1)

ThunderFrame
ThunderFrame

Reputation: 9461

You need to copy the picture as a high-resolution metafile...

Change the first argument to CopyPicture to xlPrinter.

Upvotes: 1

Related Questions