|
楼主 |
发表于 2022-9-16 14:44
|
显示全部楼层
- Sub ff()
- Dim sha As InlineShape
- Set dic = CreateObject("scripting.dictionary")
- With Application.FileDialog(3)
- .Show
- For Each f In .SelectedItems
- dic.Add Replace(Mid(f, InStrRev(f, "") + 1), ".jpg", ""), f
- Next
- End With
- Dim ta As Table
- Dim cel As Cell
- For Each ta In ActiveDocument.Tables
- For Each cel In ta.Range.Cells
- Debug.Print cel.Range.Text
- strA = Replace(Replace(Replace(cel.Range.Text, "图片", ""), Chr(13) & Chr(7), ""), Chr(13), "")
- If dic.Exists(strA) Then
- cel.Range.Text = ""
- n = cel.Width
- Set sha = cel.Range.InlineShapes.AddPicture(dic(strA))
- sha.LockAspectRatio = 1
- sha.Width = n
- End If
- Next
- Next
- End Sub
复制代码
其他问题去QQ群:溢友阁450360985。 |
|