|
为什么一定要到Excel里面去运行这个VBA?先弄个当前文档的VBA供参考吧:
- Sub 批量插入图片并调整大小()
- Dim wdTabNum As Integer, n As Integer
- Dim wdPar As Paragraph, wdRng As Range
- Dim wdInPic As InlineShape
- For wdTabNum = 1 To 2
- n = 0
- Set wdRng = ThisDocument.Tables(wdTabNum).Range.Cells(1).Range
- With wdRng.Find
- .ClearFormatting
- .Replacement.ClearFormatting
- .Execute "^13{2,}", , , True, , , , , , "^p", wdReplaceAll
- If .Execute("执法人员:", , , False) Then
- With .Parent
- .Collapse (wdCollapseStart)
- .InlineShapes.AddPicture ThisDocument.Path & "\案件照片" & wdTabNum + n & ".jpg"
- .SetRange wdRng.End + 1, wdRng.End + 1
- .InsertBefore vbCrLf & vbCrLf
- .Collapse (wdCollapseEnd)
- n = n + 1
- .InlineShapes.AddPicture ThisDocument.Path & "\案件照片" & wdTabNum + n & ".jpg"
- .SetRange wdRng.End + 1, wdRng.End + 1
- .InsertAfter vbCrLf & vbCrLf & vbCrLf
- End With
- End If
- End With
- Next
- For Each wdInPic In ThisDocument.InlineShapes
- wdInPic.Height = wdInPic.Height * (14 / PointsToCentimeters(wdInPic.Width))
- wdInPic.Width = CentimetersToPoints(14)
- Next
- MsgBox "处理完成!"
- End Sub
复制代码
相关证据粘贴页照片.rar
(13.4 KB, 下载次数: 20)
|
|