2019独角兽企业重金招聘Python工程师标准>>>
wordh宏批量设置docx中所有图片上下排列、宽度7cm
Sub 图片环绕更改()
'图片整理宏
'将图片调节为上下环绕,顶端与行对齐,左右相对于栏居中。测试于XP OFFICE2007SP2。
On Error Resume Next
For Each iShape In ActiveDocument.InlineShapes '找到所有嵌入
Set iShape = iShape.ConvertToShape
With iShape
.WrapFormat.Type = 4
'0=四周型,1=紧密型,2=穿越型,3=浮于上方,4=上下型,5=浮于下方
.WrapFormat.AllowOverlap = False '不允许重叠
.RelativeVerticalPosition = 3 '纵向相对于行对齐
'0=页边距,1=页面,2=段落,3=行,4=上边距,5=下边距,6=近边距,7=远边距
.RelativeHorizontalPosition = 2 '横向相对于栏对齐
'0=边距,1=页面,2=栏,3=字符,4=左边距,5=右边距,6=近边距,7=远边距
.Top = wdShapeTop
.Left = wdShapeCenter
'.Height = 198.45 '设置图片高度为 7cm
.Width = 198.45 '设置图片宽度7cm
End With
Next iShape
For Each iShape In ActiveDocument.Shapes '找到所有嵌入
Set iShape = iShape.ConvertToShape
With iShape
.WrapFormat.Type = 4
'0=四周型,1=紧密型,2=穿越型,3=浮于上方,4=上下型,5=浮于下方
.WrapFormat.AllowOverlap = False '不允许重叠
.RelativeVerticalPosition = 3 '纵向相对于行对齐
'0=页边距,1=页面,2=段落,3=行,4=上边距,5=下边距,6=近边距,7=远边距
.RelativeHorizontalPosition = 2 '横向相对于栏对齐
'0=边距,1=页面,2=栏,3=字符,4=左边距,5=右边距,6=近边距,7=远边距
.Top = wdShapeTop
.Left = wdShapeCenter
'.Height = 198.45 '设置图片高度为 7cm
.Width = 198.45 '设置图片宽度7cm
End With
Next iShape
End Sub