电子印章一般是在Word中用VBA代码生成。Excel中不是很普遍(我也是搬运别人的{:soso_e133:})
- Sub 电子印章()
- If Documents.Count = 0 Then Documents.Add
- Dim i$, j&, a$, f$, x!, s, t, r, arr(1 To 4) As String
- ipt:
- i = InputBox("印章正文(3-30字)和附言(2-6字)可以一起输入,但必须以中文逗号,分隔!", "电子印章", "广元电镀工业有限公司,业务专用章")
- If i = "" Then Exit Sub
- a = InStrRev(i, ",")
- If a Then f = Mid(i, a + 1): i = Left(i, a - 1) Else f = "财务专用章"
- j = Len(i)
- If j < 3 Or j > 30 Or Len(f) < 2 Or Len(f) > 6 Then GoTo ipt
- If Len(f) = 5 Then
- x = 258.4!
- ElseIf Len(f) = 4 Then x = 264.5!
- ElseIf Len(f) = 3 Then x = 263.5!: f = Left(f, 1) & " " & Mid(f, 2, 1) & " " & Right(f, 1)
- ElseIf Len(f) = 2 Then x = 270.5!: f = Left(f, 1) & " " & Right(f, 1)
- ElseIf Len(f) = 6 Then x = 251.5!
- End If
- s = Array(3.9!, 3!, 2.4!, 1.98!, 1.7!, 1.48!, 1.33!, 1.19!, 1.08!, 1!, 0.92!, 0.86!, 0.8!, 0.75!, 0.7!, 0.67!, 0.63!, 0.6!, 0.57!, 0.55!, 0.52!, 0.5!, 0.48!, 0.46!, 0.45!, 0.43!, 0.41!, 0.4!)
- t = Array(5!, 5!, 4.9!, 3.9!, 3.5!, 3.1!, 2.8!, 2.5!, 2.3!, 2!, 1.8!, 1.7!, 1.6!, 1.5!, 1.4!, 1.3!, 1.32!, 1.27!, 1.2!, 1.1!, 1.1!, 1.05!, 1!, 0.97!, 0.93!, 0.88!, 0.85!, 0.8!)
- r = Array(220!, 235!, 243!, 247!, 251!, 252!, 255!, 257!, 258.5!, 260.5!, 262!, 264!, 264.5!, 265.5!, 266.5!, 267!, 268!, 269!, 269!, 269!, 269!, 269!, 269.5!, 269.5!, 269.5!, 269.5!, 269.9!, 269.9!)
- With ActiveDocument.Shapes
- With .AddTextEffect(msoTextEffect3, i, "宋体", 12!, msoFalse, msoFalse, 219.75!, 103!)
- .TextEffect.Tracking = t(j - 3)
- .ScaleHeight 12, msoFalse, msoScaleFromTopLeft
- .ScaleWidth s(j - 3), msoFalse, msoScaleFromTopLeft
- .Adjustments(1) = r(j - 3)
- arr(1) = .Name
- End With
- With .AddShape(msoShapeOval, 201.6!, 85!, 180!, 180!)
- .Fill.Transparency = 1!
- .Line.Weight = 3.5
- .Line.Style = msoLineThickThin
- arr(2) = .Name
- End With
- With .AddShape(msoShape5pointStar, 264!, 147.8!, 54.9!, 47.6!)
- .Line.Weight = 0.25
- arr(3) = .Name
- End With
- With .AddTextEffect(msoTextEffect3, f, "宋体", 13!, msoTrue, msoFalse, x, 206!)
- .TextEffect.PresetShape = msoTextEffectShapePlainText
- .Fill.Visible = msoTrue
- .Line.Weight = 0.25
- arr(4) = .Name
- End With
- End With
- End Sub
复制代码
|