如何将一组形状另存为JPG图像? [英] How to save group of shapes as JPG image?

查看:154
本文介绍了如何将一组形状另存为JPG图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用VBA在图像上放置了许多形状,并希望将整个组另存为JPG.

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:

推荐答案

我能想到的最好的方法是将PDF导出,希望对您有所帮助.

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

这篇关于如何将一组形状另存为JPG图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆