Const t1 = 2
Const t2 = 3
If Target.Address(0, 0) = "B1" Then
a = Target.Text
If Len(a) <> 2 Then
MsgBox "出错"
Exit Sub
End If
Application.EnableEvents = False
If t1 Then a = Left(a, t1 - 1) & "爱" & Mid(a, t1)
If t2 Then a = Left(a, t1 - 1) & "你" & Mid(a, t1)
Target = a
Application.EnableEvents = True
End If
End Sub
Sub Example_AddText()Dim textObj As AcadText
Dim textString As String
Dim insertionPoint(0 To 2) As Double
Dim height As Double
' Define the text object
textString = "Hello, World."
insertionPoint(0) = 2: insertionPoint(1) = 2: insertionPoint(2) = 0
height = 0.5
ThisDrawing.ActiveLayout = ThisDrawing.Layouts("布局2") '激活指定布局
' Create the text object in model space
Set textObj = ThisDrawing.PaperSpace.AddText(textString, insertionPoint, height) '在图纸空间(刚激活的)添加文字
ZoomAll
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)