|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub InsertPictureInRoundedRectangle()
Dim rng As Range
Dim shp As Shape
' 插入圆角矩形
Set rng = Selection.Range
Set shp = ActiveDocument.Shapes.AddShape(msoShapeRoundedRectangle, rng.Left, rng.Top, 200, 100)
' 设置圆角矩形的样式
With shp
.Fill.Visible = msoTrue
.Fill.UserPicture "C:\路径\图片.jpg" ' 设置默认图片,可更改为其他图片路径
.Fill.TextureTile = msoFalse
.Fill.TextureOffsetX = 0
.Fill.TextureOffsetY = 0
.Fill.RotateWithObject = msoTrue
.Fill.Transparency = 0
.Fill.BackColor.RGB = RGB(255, 255, 255)
.Fill.ForeColor.RGB = RGB(255, 255, 255)
End With
' 粘贴剪贴板中的图片
rng.Paste
' 将剪贴板中的图片设置为圆角矩形的填充图片
With shp.Fill
.Visible = msoTrue
.UserPicture
End With
End Sub |
|