Function generateRect(sheetName As String, left As Double, top As Double)
With Worksheets(sheetName)
Dim fkImgPath As String
fkImgPath = "D:\work\imgs\fangkuang.jpg"
Dim logoImgPath As String
logoImgPath = "D:\work\imgs\logo.jpg"
Dim width As Double
width = 7 * 28.35
Dim height As Double
height = 5 * 28.35
Dim fkShape As Shape
Set fkShape = .Shapes.AddPicture(fkImgPath, MsoTriState.msoFalse, MsoTriState.msoTrue, left, top, width, height)
Dim logoShape As Shape
Set logoShape = .Shapes.AddPicture(logoImgPath, MsoTriState.msoFalse, MsoTriState.msoTrue, left + 7, top + 7, -1, -1)
Dim txt1 As Shape
Set txt1 = .Shapes.AddShape(msoShapeRectangle, left + 8, top + 26, 6.4 * 28.35, 2.4 * 28.35)
txt1.Line.Visible = msoFalse
txt1.Fill.Visible = msoFalse
txt1.ver
With txt1.TextFrame2
.HorizontalAnchor = msoAnchorCenter
.VerticalAnchor = msoAnchorMiddle
With .TextRange.Font
.NameFarEast = "华文中宋"
.Size = 20
.Bold = msoTrue
.Fill.ForeColor.RGB = RGB(0, 0, 0)
End With
.TextRange.Text = "中频逆变一体化焊机你是谁我是谁"
.WordWrap = msoTrue
.AutoSize = msoAutoSizeTextToFitShape
End With
Dim txt2 As Shape
Set txt2 = .Shapes.AddShape(msoShapeRectangle, left + 4, top + 100, 6.4 * 28.35, 0.64 * 28.35)
txt2.Fill.Visible = msoFalse
txt2.Line.Visible = msoFalse
With txt2.TextFrame2
.TextRange.Text = "负责人:陈琛琛"
With .TextRange.Font
.NameFarEast = "华文中宋"
.Size = 12
.Bold = msoTrue
.Italic = msoTrue
.Fill.ForeColor.RGB = RGB(255, 0, 0)
End With
End With
Dim txt3 As Shape
Set txt3 = .Shapes.AddShape(msoShapeRectangle, left + 4, top + 115, 6.4 * 28.35, 0.64 * 28.35)
txt3.Fill.Visible = msoFalse
txt3.Line.Visible = msoFalse
With txt3.TextFrame2
.TextRange.Text = "资产编 号:HZK-POX-001"
With .TextRange.Font
.NameFarEast = "华文中宋"
.Size = 12
.Bold = msoTrue
.Italic = msoTrue
.Fill.ForeColor.RGB = RGB(255, 0, 0)
End With
End With
End With
End Function