代码如下:
Option Explicit ‘------------------------------------------------------------------------------- ‘作用:PowerDesigner物理模型复制comment到name ‘ ‘作者: 王国狮 ‘ ‘时间: 2015-12-18 ‘ ‘版本: V1.0 ‘ ‘注意:如果name有值,将会覆盖;可以重复执行,不会多次复制 ‘------------------------------------------------------------------------------- ValidationMode = True InteractiveMode = im_Batch Dim mdl ‘当前模型 ‘获取当前活动的模型 Set mdl = ActiveModel If (mdl Is Nothing) Then MsgBox "未找到活动的模型!" ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then MsgBox "当前模型不是物理模型!" Else ProcessFolder mdl msgbox "执行完成!" End If Private sub ProcessFolder(folder) On Error Resume Next Dim Tab ‘表处理 for each Tab in folder.tables if not tab.isShortcut then if trim(tab.comment)<>"" then tab.name = trim(tab.comment) end if Dim col ‘字段处理 for each col in tab.columns if col.comment="" then else if trim(col.comment)<>"" then col.name= trim(col.comment) end if end if next end if next Dim view ‘视图处理 for each view in folder.Views if not view.isShortcut then if trim(view.comment)<>"" then view.name = trim(view.comment) end if end if next ‘进入子floder Dim f ‘子folder For Each f In folder.Packages if not f.IsShortcut then ProcessFolder f end if Next end sub
时间: 2024-09-29 22:07:53