以下是引用wyanshan在2007-6-5 9:23:04的发言:比如附件里面,我想把绘的图转换为图片,导出到WORD里面。该怎么操作?
不管是图片、图形、图表统统转成图片存到硬盘 Sub 一键导出图形到硬盘() If ActiveSheet.ProtectContents Then MsgBox "工作表已保护,本程序拒绝执行!", 64, "提示": Exit Sub If ActiveWorkbook.Path = "" Then GoTo err Dim i As Byte For i = 1 To ActiveSheet.Shapes.Count ActiveSheet.Shapes(i).Select If TypeName(Selection) = "ChartObject" Then Selection.Chart.Export ActiveWorkbook.Path & "\tmp" & i & ".jpg" Else Selection.Copy With ActiveSheet.ChartObjects.Add(0, 0, Selection.Width, Selection.Height).Chart .Paste .Export ActiveWorkbook.Path & "\tmp" & i & ".jpg" .Parent.Delete End With End If Next i Shell "EXPLORER.EXE " & ActiveWorkbook.Path, vbNormalFocus End err: MsgBox "请先将工作簿存盘!", 64, "【友情提示】" End Sub |