使用逆向工程后,得到的模型中name和code一直,comment显示在后面很不舒服,所以你需要。
1-CTRL+SHIFT+X:调出执行脚本的窗口。
2-粘贴进去如下代码然后执行
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim mdl ' the current model
' get the current active model
Set mdl = ActiveModel
If (mdl Is Nothing) Then
MsgBox "There is no current Model "
ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
MsgBox "The current model is not an Physical Data model. "
Else
ProcessFolder mdl
End If
Private sub ProcessFolder(folder)
On Error Resume Next
Dim Tab 'running table
for each Tab in folder.tables
if not tab.isShortcut then
tab.name = tab.comment
Dim col ' running column
for each col in tab.columns
if col.comment="" then
else
col.name= col.comment
end if
next
end if
next
Dim view 'running view
for each view in folder.Views
if not view.isShortcut then
view.name = view.comment
end if
next
' go into the sub-packages
Dim f ' running folder
For Each f In folder.Packages
if not f.IsShortcut then
ProcessFolder f
end if
Next
end sub
本文介绍了一种通过VBA脚本批量修改物理数据模型中表格、视图及字段名称的方法,使其与注释保持一致,适用于需要统一模型元素标识的情况。
1557

被折叠的 条评论
为什么被折叠?



