vba高手请帮忙看看??????
Sub Example_InitializeUserInput()' This example prompts for user input of a point. By using the
' InitializeUserInput method to define a keyword list, it can also
' return keywords entered by the user.
On Error Resume Next
' Define the valid keywords
Dim keywordList As String
keywordList = "Keyword1 Keyword2"
' Call InitializeUserInput to setup the keywords
ThisDrawing.Utility.InitializeUserInput 128, keywordList
' Get the user input
Dim returnPnt As Variant
returnPnt = ThisDrawing.Utility.GetPoint(, "Enter a point(Keyword1, Keyword2): ")
If Err Then
If StrComp(Err.Description, "User input is a keyword", 1) = 0 Then
' One of the keywords was entered
Dim inputString As String
Err.Clear
inputString = ThisDrawing.Utility.GetInput
MsgBox "You entered the keyword: " & inputString
Else
MsgBox "Error selecting the point: " & Err.Description
Err.Clear
End If
Else
' Display point coordinates
MsgBox "The WCS of the point is: " & returnPnt(0) & ", " & returnPnt(1) & ", " & returnPnt(2), , "GetInput Example"
End If
End Sub
上面是2002中vba帮助文件的一个例子,在英文版中当输入字符时Err.Description返回 "User input is a keyword",但在中文版输入字符时Err.Description返回一个“???组件错误”。
请问vba高手这是怎么回事?
系统:win98se,autocad2002中、英文D版,中文版用算号器破解。
Err.Des Scription 把錯字→ Err.DesScription
已改,还是不行啊
你的目的是什么?
程序并没有出现什么不对的地方呀。只不过在程序运行过程中,用户输入错误时,中文版和西文版VBA返回不同的错误代码(Err.Description),这应该说一点也不奇怪,你要在中文版中正确运行程序,只要将这句代码改动一下,应该就可以了。
If StrComp(Err.Description, "User input is a keyword", 1) = 0 Then
改为:
If StrComp(Err.Description, "???组件错误", 1) = 0 Then
你试过吗?事实上InitializeUserInput的关键字在中文版中根本不好使。
页:
[1]