|
Option Explicit
Sub PicOut()
Dim ar, i&, ImageStream As Object, strPath$, strFileName$
strPath = ThisDocument.Path & "\WORD中批量导出的图片\"
If Dir(strPath, 16) = "" Then MkDir strPath
Set ImageStream = CreateObject("ADODB.Stream")
With ActiveDocument
For i = 1 To .InlineShapes.Count
.InlineShapes(i).Select
With Selection
.Collapse
.MoveDown unit:=wdLine
.MoveEndUntil vbCr
strFileName = strPath & .Range.Text & ".png"
End With
If Dir(strFileName) <> "" Then Kill strFileName
With ImageStream
.Open
.Type = 1
.Write ActiveDocument.InlineShapes(i).Range.EnhMetaFileBits
.SaveToFile strFileName
.Close
End With
Next i
End With
Set ImageStream = Nothing
MsgBox "ok"
End Sub |
评分
-
1
查看全部评分
-
|