利用VBA把PowerDesigner的comment复制到name
2015-12-18 14:13
721 查看
代码如下:
Option Explicit '------------------------------------------------------------------------------- '作用:PowerDesigner物理模型复制comment到name ' '作者: Lio5n ' '时间: 2015-12-22 ' '版本: V2.0 ' '注意:如果name有值,将会覆盖;可以重复执行,不会多次复制 '------------------------------------------------------------------------------- ValidationMode = True InteractiveMode = im_Batch '----------------------------------请按需设置----------------------------------- CONST CopyType = "ONE" '执行模式 [ ONE-单表 ALL-所有表 ] CONST TabCode = "TabCode" '单表模式下,表的Code CONST ViewCode = "ViewCode" '单表模式下,视图的Code '------------------------------------------------------------------------------- Dim mdl '当前模型 Dim Cnt '处理个数 Cnt = 0 Set mdl = ActiveModel If ( mdl Is Nothing ) Then MsgBox "未找到活动的模型!" ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then MsgBox "当前模型不是物理模型!" Else ProcessFolder mdl MsgBox "执行完成,共检索 [ " + CStr(Cnt) + " ] 张表!" End If Private Sub ProcessFolder(folder) On Error Resume Next Dim Tab '定义表 For Each Tab In folder.tables If CopyType = "ONE" And UCase(Tab.code) <> UCase(TabCode) Then ElseIf Not Tab.isShortcut Then Cnt = Cnt + 1 '表处理 If Trim(Tab.comment) <> "" Then Tab.name = Trim(Tab.comment) End If '字段处理 Dim Col For Each Col In Tab.columns If Trim(Col.comment) <> "" Then Col.name = Trim(Col.comment) End If Next End If Next '视图处理 Dim View For Each View In folder.Views If CopyType = "ONE" And UCase(View.code) <> UCase(ViewCode) Then Else If Not View.isShortcut Then Cnt = Cnt + 1 If Trim(View.comment) <> "" Then View.name = Trim(View.comment) End If End IF End If Next '进入子floder Dim f For Each f In folder.Packages If Not f.isShortcut Then ProcessFolder f End If Next End Sub
相关文章推荐
- 利用VBA把PowerDesigner的name复制到comment
- 行情列表重构 TabBar&NavBar&tableView
- 解决Unable to load R3 module ...VBoxDD.dll (VBoxDD):GetLastError=1790
- 利用VBA从Excel导入数据模型到PowerDesigner
- 利用VBA把PowerDesigner导出到Excel
- VBoxManage命令详解
- 函数模块:CTVB_COMPARE_TABLES--两个表中删除/变更/粘贴分解
- VB6.0 读取Excel文件并返还数据集RecordSet
- vb学习基础之val函数与val(&HFFFF) 的理解
- Phone_DVB+OTT项目首页
- vb制作单片机 上位机 (1) 控制单个电灯开关
- [VBS] Working with DOS Command Line
- VB6.0 获取Excel文件工作表Sheet的名称
- 【VBA研究】定时关闭MsgBox及相关未公开的API
- 因为PPBC的防盗链,尝试用vba的对象来解决,顺便复习一下。。。
- vb常用函数一览表
- Excel VBA简单使用——数据缺失处理
- VB中PictureBox控件使用教程
- vbScript 备忘
- VBA 中 do-loop,do-while-loop,do-until-loop,for-each-next 的小例子