|
今日看了http://club.excelhome.net/thread-1219628-1-1.html这个帖子,学习电子公章制作,由于本人是小白,确实一无所知。
本人操作步骤:
1、建立一个新excel文件;
2、按ALT+F8;
3、复制帖子里的代码: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
With .Range(Array(arr(1), arr(2), arr(3), arr(4))).Group '组合
.Fill.ForeColor.RGB = RGB(255, 0, 0)
.Line.ForeColor.RGB = RGB(255, 0, 0)
.LockAspectRatio = msoTrue
.ScaleWidth 0.6, msoFalse, msoScaleFromTopLeft
.ScaleHeight 0.6, msoFalse, msoScaleFromTopLeft
.IncrementTop 92.6!
.IncrementLeft 119.4!
.ZOrder msoSendBehindText
.Select
End With
End With
End Sub
单击运行,程序报错,如截图,请各位老师和朋友能指导一下,谢谢!
|
|