单元格区域导出为图像,没有白色边框

时间:2019-03-27 16:21:02

标签: excel vba

我正在使用vba将同一工作表中的多个单元格范围导出为图像。尽管使用下面的代码可以完美地完成任务,但是所有图像都带有白色细边框导出。我已经插入了应该删除边框的内容,但这不起作用。我的代码如下

Dim oWs As Worksheet
Dim oRng As Range
Dim oChrtO As ChartObject
Dim lWidth As Long, lHeight As Long
Set oWs = Sheets("sheet2")

oWs.Select
Set oRng = oWs.Range("g35:i44")
oRng.CopyPicture xlScreen, xlPicture
lWidth = oRng.width
lHeight = oRng.height
Set oChrtO = oWs.ChartObjects.Add(Left:=0, Top:=0, width:=lWidth, 
height:=lHeight)
oChrtO.Activate
With oChrtO.Chart
.ChartArea.Format.Line.Visible = msoFalse
.Paste
.Export Filename:="C:\Users\tg033980\Desktop\JSS 
 project\img\MNTH1_A.png", Filtername:="PNG"
 End With
 oChrtO.Delete`

0 个答案:

没有答案