沐风论坛

标题: 用vb二次开发,实现catia批量文件重命名 [打印本页]

作者: 飞鸟栖木    时间: 2017-2-12 11:58
标题: 用vb二次开发,实现catia批量文件重命名
在网上找了一个代码,但是,运行提示全局变量定义有问题,求解答!

Public SelectionList(5000) As Object                      ——这一行定义有问题
Public countl As Integer
Public sel
Private Sub CommandButton1_Click()
Name1 = TextBox1.Text
Startindex1 = TextBox2.Text
step1 = TextBox3.Text
Suffix1 = TextBox4.Text
For i = 1 To count1
If (Asc(Startindex1) < 48 Or Asc(Startindex1) > 57) And Left(Startindex1, 1) <> "-" Then
Selection(i).Name = Name1 & Chr(Asc(Startindex1) + (i - 1) * Val(step1)) & Suffix1
Else
SelectionList(i).Name = Name1
End If
Next
End Sub
Private Sub CommandButton2_Click()
End
End Sub
Private Sub label1_Click()
End Sub
Private Sub UserForm_Click()
End Sub
Private Sub UserForm_Initialize()
Set sel = CATIA.ActiveDocument.Selection
sel.Clear
Dim InputObjectType(0)
InputObjectType(0) = "AnyObject"
Status = sel.selectelment3(InputObjectType, "selectobjects to rename", True, CATMultiSelTriggWhenUserValidatesSelection, False)
If (Status = "Cancel") Then
End
End If
countl = sel.Count
For i = 1 To count1
Set SeletionList(i) = sel.Item(i).Value
Next
TextBox1 = SetFocus
TextBox2.Value = SelectionList(1).Name
TextBox2.Value = 1
TextBox3.Value = 1
End Sub


作者: dayibalang01    时间: 2017-3-20 12:14
把as object去掉或者注释掉就好了,另外一个sub就没必要用public了
作者: liu279900123    时间: 2018-3-18 15:55
Public SelectionList(5000) As Object   出现语句未结束,这是什么问题




欢迎光临 沐风论坛 (https://bbs.mfcad.com/) 沐风网 X3.1