想用宏實作一下,插入到word中的圖片(嵌入模式)自動排版功能:
在一個word中插入了50張照片,每張照片寬4,高5厘米,1張圖片占1行復制4份擺放,圖片之間用一個空格隔開,所有的圖片都這做,
批量設定大小4*5cm高,我用宏已實作,
For i = 1 To ActiveDocument.InlineShapes.Count
ActiveDocument.InlineShapes(i).Width = 4 * 28.35
ActiveDocument.InlineShapes(i).Height = 5 * 28.35
Next i
接下來的圖片復制,敲空格隔開,回車換行,用宏怎么弄?
uj5u.com熱心網友回復:
剛才試了下,下面的好像是可以的。這里有個意外,先取了所有圖片到個變數,再粘貼圖片后,那個變數里的圖片竟然也增加了;所以,只好把原圖片個體先保存在了個陣列里。Option Explicit
Sub Do4Pics()
Dim xInShps As InlineShapes
Dim xShp1 As InlineShape
Dim xShps(1 To 100) As InlineShape
Dim i As Integer
Dim iCnt As Integer
Set xInShps = ActiveDocument.InlineShapes
iCnt = xInShps.Count
For i = 1 To iCnt
Set xShps(i) = xInShps(i)
Next i
For i = 1 To iCnt
Set xShp1 = xShps(i)
xShp1.Select
With Selection
.Copy
.MoveRight unit:=wdCharacter, Count:=1
.TypeText Text:=" "
.Paste
.TypeText Text:=" "
.Paste
.TypeText Text:=" "
.Paste
.TypeText Text:=Chr(13) & Chr(10)
End With
Next i
End Sub
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/284758.html
