Hey people!
I need help with my VBA code, because I have got stuck at one point. I have a code that creates a .png image of a certain range of the Excel document. The picture is then saved on my computer. When I open the image, it's an ugly line around the entire image and the image is not centered, but placed in the left hand corner.
I want help to remove the border around the image and to auto-size the chart to fit the image.
I have this code:
Here's the picture:Sub SaveAsAPic()
Application.ScreenUpdating = False
With Charts.Add
.SetSourceData Source:=Sheets("groups").Range("A1")
Do While .SeriesCollection.Count > 0
.SeriesCollection(1).Delete
Loop
Sheets("groups").Range("A1:I24").CopyPicture Appearance:=xlScreen, Format:=xlPicture
.Paste
.Export Filename:="C:\gruppsel" & ".png", FilterName:="PNG"
End With
Application.DisplayAlerts = False
ActiveWorkbook.Charts.Delete
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
NEW_PICTURE.gif
Bookmarks