矩形宏可以重复3次

时间:2019-01-29 17:31:29

标签: excel

我想问一下下面的代码创建一个带有文本“ CONFIDENTIAL”的矩形。请帮助我,此矩形在Paper的Legal页面大小中重复3次,并且垂直分布均匀。对于样本,我正在插入图像。该图显示了三个滑条,其中相应地设置了矩形。

enter image description here

Sub ShapeConfidential()

    Dim shpConf As shape

    On Error GoTo CreateConf

        Set shpConf = ActiveSheet.Shapes("CONFIDENTIAL")

        'GoTo PrnPrv
        Exit Sub

CreateConf:
        Set shpConf = ActiveSheet.Shapes.AddShape(msoShapeRectangle, 70, 130, 324, 144)

        shpConf.Name = "CONFIDENTIAL"

        With shpConf.TextFrame
            .Characters.Text = "CONFIDENTIAL"
            .Characters.Font.Name = "Arial Black"
            .Characters.Font.Size = 36
            .Characters.Font.Color = RGB(251, 0, 0)
            .Characters.Font.Bold = False
            .HorizontalAlignment = xlHAlignCenter
            .VerticalAlignment = xlVAlignCenter
        End With

        shpConf.Rotation = -30
        shpConf.Fill.Visible = msoFalse
        shpConf.Line.Visible = msoFalse
        shpConf.Fill.Transparency = 0.5

End Sub

0 个答案:

没有答案