Reputation:
I place a number of shapes on an image using VBA and want to save the whole group as a JPG.
Sub SaveImageTEST()
ActiveSheet.Shapes.Range(Array("Picture 1")).SaveAsPicture "worldmap.jpg"
End Sub
The idea is to visualize data on a map:
Upvotes: 1
Views: 2891
Reputation: 41
The best that I could come up with is to export as pdf, hopes this helps.
Sub SaveImage()
'On Error Resume Next
Set ws = ActiveSheet
Set shp = ws.Shapes.Range(Array("Picture 1"))
Set ch = ws.ChartObjects.Add(shp.Left, shp.Top, shp.Width, shp.Height)
shp.Select
Selection.Copy
ch.Chart.Paste
Set tt = ch.Chart
'tt.ExportAsFixedFormat Type:=xlTypePDF, Filename:="c:\outputFileName"
tt.Export Filename:="C:\test.png", filtername:="PNG"
ch.Delete
End Sub
Upvotes: 1