代码改变世界

AutoCAD VBA欢迎窗口程序

2011-03-19 21:57  精诚所至 金石为开  阅读(528)  评论(0编辑  收藏  举报

AutoCAD VBA欢迎程序,代码如下。

Public Sub HelloVba()
Dim strname As String
strname = InputBox("请输入你的名字", "helloVBA", "My Friend")
MsgBox strname & "让我们在图形窗口中欢迎你!"
Dim text As AcadText
Dim insertPoint(0 To 2) As Double
insertPoint(0) = 10
insertPoint(1) = 10
insertPoint(2) = 10
Set text = ThisDrawing.ModelSpace.AddText("Hello,VBA!", insertPoint, 5)
ThisDrawing.Application.ZoomExtents
End Sub

代码完。

Beginning is hard.