|
本帖最后由 爱到天涯 于 2012-2-9 08:07 编辑
- Sub 从Excel工作表导出图片() Dim Shp As Shape
- Dim chrobj As ChartObject
- Dim FileName As String
- For Each Shp In Sheet1.Shapes
- If Shp.Type = msoPicture Then
- FileName = ThisWorkbook.Path & "" & Shp.Name & ".gif"
-
- Shp.CopyPicture xlPrinter
- Set chrobj = Sheet1.ChartObjects.Add(0, 0, Shp.Width, Shp.Height) '注意度量单位
-
- With chrobj.Chart
- .Paste
- ActiveSheet.Shapes(ActiveSheet.Shapes.Count).Fill.Visible = msoFalse
- ActiveSheet.Shapes(ActiveSheet.Shapes.Count).Line.Visible = msoFalse
- .Export FileName, "gif", True
- .Parent.Delete
- End With
- End If
- Next
- End Sub
复制代码 已经没有边框了。刚才仔细看了下录制宏,粘贴CHART为对象的时候,大家请注意,新建的CHART对象,默认的边框为1像素,所以要把他清零。呵呵、、、、、香川群子老师是对的,只是代码写错了,也不怪他,MS搞的很奇怪,要shape对象来控制CHART对象的边框。
这个问题解决办法很多,API,甚至FSO,都行。
|
|