|
各位老师:
我在用网上这段批量导出图片到文件夹的代码中,发现所有导出图片的顶边与左边有带有边框, 如何在导出图片时不要这些边框,请老师们帮忙看一下如何更改代码!
批量导出图片到文件夹.rar
(1.63 MB, 下载次数: 4)
Sub 导出图片()
Dim shp As Shape
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
For Each shp In ActiveSheet.Shapes
'Set Rng = Shp.TopLeftCell '//Range 对象,它代表位于指定对象左上角下方的单元格
r = shp.TopLeftCell.Row
If shp.TopLeftCell.Column = 2 Then '图片在第二列
mc = ActiveSheet.Cells(r, 1) '货号在第1列
End If
shp.Copy
'With ActiveSheet.ChartObjects.Add(shp.Top + 1, shp.Left + 1, shp.Width, shp.Height).Chart
With ActiveSheet.ChartObjects.Add(0, 0, shp.Width + 1, shp.Height + 1).Chart
.Line.Visible = msoFalse
.Parent.Select
.Paste
.Export ThisWorkbook.Path & "\图片\" & mc & ".JPG" '导出为图片径为当前EXCEL位置的图片文件夹 格式,如JPG,GIF
.Parent.Delete
End With
Next
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
|
|