The code is as follows:
Option Explicit '-------------------------------------------------------------------------------'role: PowerDesigner physical model Copy name to comment"'Author: lio5n'Time: 2015-12-18"'version: V1.0"'Description: If comment has a value, it is not overwritten; can be repeated and not replicated multiple times'-------------------------------------------------------------------------------Validationmode=TrueInteractivemode=Im_batchDimmdl'Current Model'gets the currently active model SetMDL =ActivemodelIf(MDL is Nothing) Then MsgBox "the active model was not found! " ElseIf notmdl. IsKindOf (Pdpdm.cls_model) Then MsgBox "The current model is not a physical model! " ElseProcessFolder MDLMsgBox "execution Done! " End If'Copy the name to comment function Private SubProcessFolder (folder)Dim Tab 'Table Processing for each Tab inchFolder.tablesif not Tab. isshortcut Then if Left(Trim(Tab. Comment),Len(Trim(Tab. Name)) <>Trim(Tab. Name) Then Tab. Comment =Trim(Tab. Name) +" "+Trim(Tab. Comment)Tab. Comment =Trim(Tab. Comment)End if DimCol'Field Handling for eachColinch Tab. Columnsif Left(Trim(Col.comment),Len(Trim(col.name))) <>Trim(Col.name) Thencol.comment=Trim(col.name) +" "+Trim(col.comment) col.comment=Trim(col.comment)End if Next End if Next DimView'View Processing for eachViewinchfolder. viewsif notView.isshortcut Then if Left(Trim(View.comment),Len(Trim(view.name))) <>Trim(View.name) Thenview.comment=Trim(view.name) +" "+Trim(view.comment) view.comment=Trim(view.comment)End if End if Next 'Enter Sub Floder DimF'Sub Folder for eachFinchfolder. Packagesif notF.isshortcut ThenProcessFolder FEnd if Next End Sub
Use VBA to copy the name of PowerDesigner to comment