|
楼主 |
发表于 2022-2-10 19:48
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
衷心感谢您,问题已彻底解决!分三个步骤:
1、用下面的代码将图片居中;
Sub ImageAlignCenter()
With ActiveDocument.Content.Find
.ClearFormatting '清除格式设置
With .Replacement '替换条件
.ClearFormatting '清除格式设置
End With
.Execute FindText:="^l", ReplaceWith:="^p", Format:=True, Replace:=wdReplaceAll
End With
For Each InlineS In ActiveDocument.InlineShapes
InlineS.Select
Selection.MoveLeft Unit:=wdWord, Count:=1
Selection.TypeParagraph
Next
With ActiveDocument.Content.Find
.ClearFormatting '清除格式设置
With .Replacement '替换条件
.ClearFormatting '清除格式设置
End With
.Execute FindText:="^p^p", ReplaceWith:="^p", Format:=True, Replace:=wdReplaceAll
End With
For Each InlineS In ActiveDocument.InlineShapes
InlineS.Select
ActiveWindow.Selection.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter
Next
End Sub
2、用下面的代码,浮于文字上方
For Each iShape In ActiveDocument.InlineShapes
iShape.ConvertToShape
Next iShape
3、用^p^p替换为^p
再次感谢您!
|
|