|
Sub VBA提取Word里面图片()
Dim i As Integer, Str As String, Path As String
Dim Word, Myword As Object
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Path = ThisWorkbook.Path & "\"
Str = Dir(Path & "*.docx")
Set Word = VBA.CreateObject("word.application")
Do While Str <> ""
If Not (Str = "提取Word图片.xlsm") Then
Set Myword = Word.Documents.Open(Path & Str)
Word.Visible = True
Myword.InlineShapes(2).Select
Word.Selection.Copy
i = i + 1
ActiveSheet.Cells(i, 1) = Split(Str, ".")(0)
ActiveSheet.Cells(i, 2).Activate
ActiveSheet.PasteSpecial Format:="图片(增强型图元文件)", Link:=False, DisplayAsIcon:=False
Myword.Close True
End If
Loop
Word.Close
MsgBox "提取完毕!", , "报告!"
End Sub
|
评分
-
1
查看全部评分
-
|