沐风论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 7878|回复: 5
打印 上一主题 下一主题

[问题求助] 用vb二次开发,实现catia批量文件重命名

[复制链接]
跳转到指定楼层
楼主
发表于 2017-2-12 11:58:15 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
在网上找了一个代码,但是,运行提示全局变量定义有问题,求解答!

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

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏1 转播转播 分享分享 分享淘帖 支持支持 反对反对
回复

使用道具 举报

沙发
发表于 2017-3-20 12:14:01 | 只看该作者
把as object去掉或者注释掉就好了,另外一个sub就没必要用public了
回复 支持 反对

使用道具 举报

板凳
发表于 2018-3-18 15:55:28 | 只看该作者
Public SelectionList(5000) As Object   出现语句未结束,这是什么问题
回复 支持 反对

使用道具 举报

*滑动验证:
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|沐风论坛 ( 沪ICP备09092249号  

GMT+8, 2024-5-6 11:30 , Processed in 0.571454 second(s), 20 queries .

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表