ER/スタジオロゴ
ER/スタジオロゴ
ホーム > リソースセンター > データ・セキュリティ情報も追加

データ・セキュリティ情報も追加

はじめに

This is the third post regarding the binding of custom properties to specific ER objects.

と the first one, we saw how to bind attachments to one type of ER object.

Then, we extended the different macros to bind the attachments to several ER objects.

Now, in this one, we’ll support some new ER objects (Models, Submodels, ビジネス データオブジェクト) and we’ll filter the types of ER objects that can be bound to each Attachment Type.

Attachment Type Usage
Attachment Type Usage

Even more importantly, we’ll also integrate the Data Security Information so it can also be automatically bound to their relative ER Objects.

Data Security Information
Data Security Information

By the way, the different strings used by the macros for the Attachment Types, Security Types, Excel Spreadsheets can be easily customized in the script named wBindPropertiesToERObjects.bas.

' Labels used in the different Attachments or Security Data Information Types
パブリック コンスト MODELS$			= "Models"
パブリック コンスト SUBMODELS$			= "Submodels"
パブリック コンスト BUSINESSDATAOBJECTS$	= "BusinessDataObjects"
パブリック コンスト ENTITIES$			= "Entities"
パブリック コンスト TABLES$			= "Tables"
パブリック コンスト VIEWS$			= "Views"
パブリック コンスト RELATIONSHIPS$ 		= "Relationships"
パブリック コンスト ATTRIBUTES$		= "Attributes"
パブリック コンスト COLUMNS$			= "Columns"

' Delimiter used between the different Labels
パブリック コンスト DELIMITER$			= "|"

' Empty = Local Data Dictionary; Name of the Enterprise Data Dictionary
パブリック コンスト DICTIONARY_NAME$		= "Custom properties"
'Public Const DICTIONARY_NAME$		= ""

' Excel sheets names
パブリック コンスト XL_TAB_ATTACHMENT$ 	= "Attachments"
パブリック コンスト XL_TAB_SECURITY$		= "Data Security Information"

Feel free to update them according to your requirements.

This short video shows the usage of an Enterprise Data Dictionary containing Attachments and Data Security Information with different projects:

Below are the 5 usual scripts updated with the previously mentioned enhancements.

Scripts

wBindPropertiesToERObjects.bas

'#Language "WWB-COM"
''MACRO TITLE: wBind Properties to ER Objects
' MACRO VERSION: 3.0
'This macro binds the Attachments and Data Security Information
'	for Entities, Tables, Attributes, Columns, Relationships, Views,
'	Models, Submodels & Business Data Objects
'
' Release notes
' 3.0: Bind Data Security Information too
' 2.0: ToImportExport & IsMatching functions added
' 1.0: Initial version
'---------------------------------------------------------------------------

オプション Explicit

' Labels used in the different Attachments or Security Data Information Types
パブリック コンスト MODELS$			= "Models"
パブリック コンスト SUBMODELS$			= "Submodels"
パブリック コンスト BUSINESSDATAOBJECTS$	= "BusinessDataObjects"
パブリック コンスト ENTITIES$			= "Entities"
パブリック コンスト TABLES$			= "Tables"
パブリック コンスト VIEWS$			= "Views"
パブリック コンスト RELATIONSHIPS$ 		= "Relationships"
パブリック コンスト ATTRIBUTES$		= "Attributes"
パブリック コンスト COLUMNS$			= "Columns"

' Delimiter used between the different Labels
パブリック コンスト DELIMITER$			= "|"

' Empty = Local Data Dictionary; Name of the Enterprise Data Dictionary
パブリック コンスト DICTIONARY_NAME$		= "Custom properties"
'Public Const DICTIONARY_NAME$		= ""

' Excel sheets names
パブリック コンスト XL_TAB_ATTACHMENT$ 	= "Attachments"
パブリック コンスト XL_TAB_SECURITY$		= "Data Security Information"

' DO NOT EDIT THE FOLLOWING CONSTANTS
' Datatypes constants
パブリック コンスト BOOLEAN_TYPE%		= 1
パブリック コンスト DATE_TYPE%			= 2
パブリック コンスト EXTERNAL_FILE_PATH_TYPE%	= 3
パブリック コンスト NUMERIC_TYPE%		= 4
パブリック コンスト TEXT_TYPE%			= 5
パブリック コンスト TEXT_LIST_TYPE%		= 6
パブリック コンスト TIME_TYPE%			= 7

' Datatypes used by the different Attachments Types: ValidAttachmentBinding.ObjectType
パブリック コンスト VAB_MODELS$		= "Model"
パブリック コンスト VAB_SUBMODELS$		= "SubModel"
パブリック コンスト VAB_BUSINESSDATAOBJECTS$	= "Business Data Object"
パブリック コンスト VAB_ENTITIES_TABLES$	= "Entity / Table"
パブリック コンスト VAB_VIEWS$			= "View"
パブリック コンスト VAB_RELATIONSHIPS$ 	= "Relationship"
パブリック コンスト VAB_ATTRIBUTES_COLUMNS$	= "Attribute / Column"

' Excel constants
パブリック コンスト xlCenter% 				= -4108
パブリック コンスト xlBottom% 				= -4107
パブリック コンスト xlTop%				= -4160
パブリック コンスト xlLeft%				= -4131
パブリック コンスト xlRight%				= -4152
パブリック コンスト xlCalculationAutomatic&		= -4105
パブリック コンスト xlCalculationManual& 		= -4135
パブリック コンスト xlCalculationSemiautomatic&	= 2

サブ メイン
	
	オン エラー GoTo ErrorEnd

	DiagramManager.EnableScreenUpdateEx(False, False)
	Debug.クリア
	BindProperties(False)

ErrorEnd:
	DiagramManager.EnableScreenUpdateEx(真, 真)

終了 Sub

Public サブ BindProperties(currentModelOnly として ブーリアン)

	薄暗い MyDictionary として Dictionary

	薄暗い MyDiagram として ダイアグラム
	薄暗い MyModel として モデル

	セット MyDiagram = DiagramManager.ActiveDiagram

	もし Not MyDiagram そうなのか? 何もない では

		もし DICTIONARY_NAME = "" では
			セット MyDictionary = MyDiagram.Dictionary
		その他
			セット MyDictionary = MyDiagram.EnterpriseDataDictionaries.Item(DICTIONARY_NAME)
		終了 もし

		もし Not (MyDictionary そうなのか? 何もない) では
			
			デバッグ。.プリント
			もし currentModelOnly では
		
				セット MyModel = MyDiagram.ActiveModel
				BindModelAttachment(MyDictionary, MyModel)
				BindModelSecurity(MyDictionary, MyModel)
		
			その他
				
				について Each MyModel In MyDiagram.Models
					
					BindModelAttachment(MyDictionary, MyModel)
					BindModelSecurity(MyDictionary, MyModel)
		
				次のページ
		
			終了 もし

		その他
			
			デバッグ。.プリント "Data dictionary not available!"

		終了 もし

	その他
		
		デバッグ。.プリント "No project opened!"

	終了 もし

終了 サブ

プライベート サブ BindModelAttachment(MyDictionary として Dictionary, MyModel として Model)
	
	薄暗い MyEntity として エンティティ
	薄暗い MyAttribute として AttributeObj
	薄暗い MyRelationship として 人間関係
	薄暗い MyView として 表示
	薄暗い MySubModel として SubModel
	薄暗い MyBusinessDataObject として BusinessDataObject

	薄暗い MyBoundAttachment として BoundAttachment
	薄暗い MyAttachmentType として AttachmentType
	薄暗い MyAttachment として Attachment

	Debug.プリント "Attachments"

	' Bind Models' Attachments
	デバッグ。.プリント "Model:" & vbTab & MyModel.Name

	について Each MyAttachmentType In MyDictionary.AttachmentTypes
		
		もし IsMatching(MyAttachmentType.Name, MODELS) では
			
			について Each MyAttachment In MyAttachmentType.Attachments

				MyModel.BoundAttachments.Add(MyAttachment.ID)

			次のページ

		終了 もし

	次のページ

	' Bind Submodels' Attachments
	について Each MySubModel In MyModel.SubModels
		
		Debug.プリント "Submodel:" & vbTab & MySubModel.Name

		について Each MyAttachmentType In MyDictionary.AttachmentTypes
			
			もし IsMatching(MyAttachmentType.Name, SUBMODELS) では
				
				について Each MyAttachment In MyAttachmentType.Attachments
	
					Debug.プリント "[" & MyAttachmentType.Name & "]" & vbTab & "Submodel:" & vbTab & MySubModel.Name
					MySubModel.BoundAttachments.Add(MyAttachment.ID)
	
				次のページ

			終了 もし

		次のページ

	次のページ

	' Bind Entities' Attachments
	について Each MyEntity In MyModel.Entities
		
		Debug.プリント IIf(MyModel.Logical, "Entity:" & vbTab & MyEntity.EntityName, "Table:" & vbTab & MyEntity.TableName)

		について Each MyAttachmentType In MyDictionary.AttachmentTypes
			
			もし IsMatching(MyAttachmentType.Name, IIf(MyModel.Logical, ENTITIES, TABLES)) では
				
				について Each MyAttachment In MyAttachmentType.Attachments
	
					MyEntity.BoundAttachments.Add(MyAttachment.ID)
	
				次のページ

			終了 もし

		次のページ

		' Bind Attributes' Attachments
		について Each MyAttachmentType In MyDictionary.AttachmentTypes
			
			もし IsMatching(MyAttachmentType.Name, IIf(MyModel.Logical, ATTRIBUTES, COLUMNS)) では
	
				について Each MyAttribute In MyEntity.Attributes
	
					Debug.プリント "[" & MyAttachmentType.Name & "]" & vbTab & IIf(MyModel.Logical, "Attribute:" & vbTab & MyAttribute.AttributeName, "Column:" & vbTab & MyAttribute.ColumnName)

					について Each MyAttachment In MyAttachmentType.Attachments
	
						MyAttribute.BoundAttachments.Add(MyAttachment.ID)
	
					次のページ

				次のページ
	
			終了 もし

		次のページ

	次のページ

	' Bind Relationships' Attachments
	について Each MyRelationship In MyModel.Relationships
		
		Debug.プリント "Relationship:" & vbTab & MyRelationship.Name

		について Each MyAttachmentType In MyDictionary.AttachmentTypes
			
			もし IsMatching(MyAttachmentType.Name, RELATIONSHIPS) では
				
				について Each MyAttachment In MyAttachmentType.Attachments
	
					MyRelationship.BoundAttachments.Add(MyAttachment.ID)
	
				次のページ

			終了 もし

		次のページ

	次のページ

	' Bind Views' Attachments
	について Each MyView In MyModel.Views
		
		Debug.プリント "View:" & vbTab & MyView.Name

		について Each MyAttachmentType In MyDictionary.AttachmentTypes
			
			もし IsMatching(MyAttachmentType.Name, VIEWS) では
				
				について Each MyAttachment In MyAttachmentType.Attachments
	
					MyView.BoundAttachments.Add(MyAttachment.ID)
	
				次のページ

			終了 もし

		次のページ

	次のページ

	' Bind Business Data Objects' Attachments
	について Each MyBusinessDataObject In MyModel.BusinessDataObjects
		
		Debug.プリント "BDO:" & vbTab & IIf(MyModel.Logical, MyBusinessDataObject.LogicalName, MyBusinessDataObject.PhysicalName)

		について Each MyAttachmentType In MyDictionary.AttachmentTypes
			
			もし IsMatching(MyAttachmentType.Name, BUSINESSDATAOBJECTS) では
				
				について Each MyAttachment In MyAttachmentType.Attachments
	
					MyBusinessDataObject.BoundAttachments.Add(MyAttachment.ID)
	
				次のページ

			終了 もし

		次のページ

	次のページ

	デバッグ。.Print

End サブ

プライベート サブ BindModelSecurity(MyDictionary として Dictionary, MyModel として Model)
	
	薄暗い MyEntity として エンティティ
	薄暗い MyAttribute として AttributeObj
	薄暗い MyRelationship として 人間関係
	薄暗い MyView として 表示
	薄暗い MySubModel として SubModel
	薄暗い MyBusinessDataObject として BusinessDataObject

	薄暗い MyBoundAttachment として BoundAttachment
	薄暗い MySecurityType として SecurityType
	薄暗い MySecurityProperty として SecurityProperty

	Debug.プリント "Security"

	' Bind Models' Data Security Infomartion
	デバッグ。.プリント "Model:" & vbTab & MyModel.Name

	について Each MySecurityType In MyDictionary.SecurityTypes
		
		もし IsMatching(MySecurityType.Name, MODELS) では
			
			について Each MySecurityProperty In MySecurityType.SecurityProperties

				MyModel.BoundSecurityProperties.Add(MySecurityProperty.ID)

			次のページ

		終了 もし

	次のページ

	' Bind Submodels' Data Security Infomartion
	について Each MySubModel In MyModel.SubModels
		
		Debug.プリント "Submodel:" & vbTab & MySubModel.Name

		について Each MySecurityType In MyDictionary.SecurityTypes
			
			もし IsMatching(MySecurityType.Name, SUBMODELS) では
				
				デバッグ。.プリント "[" & MySecurityType.Name & "]" & vbTab & "Submodel:" & vbTab & MySubModel.Name

				について Each MySecurityProperty In MySecurityType.SecurityProperties
	
					MySubModel.BoundSecurityProperties.Add(MySecurityProperty.ID)
	
				次のページ

			終了 もし

		次のページ

	次のページ

	' Bind Entities' Data Security Infomartion
	について Each MyEntity In MyModel.Entities
		
		Debug.プリント IIf(MyModel.Logical, "Entity:" & vbTab & MyEntity.EntityName, "Table:" & vbTab & MyEntity.TableName)

		について Each MySecurityType In MyDictionary.SecurityTypes
			
			もし IsMatching(MySecurityType.Name, IIf(MyModel.Logical, ENTITIES, TABLES)) では
				
				について Each MySecurityProperty In MySecurityType.SecurityProperties
	
					MyEntity.BoundSecurityProperties.Add(MySecurityProperty.ID)
	
				次のページ

			終了 もし

		次のページ

		' Bind Attributes' Data Security Infomartion
		について Each MySecurityType In MyDictionary.SecurityTypes
			
			もし IsMatching(MySecurityType.Name, IIf(MyModel.Logical, ATTRIBUTES, COLUMNS)) では
	
				について Each MyAttribute In MyEntity.Attributes
	
					Debug.プリント "[" & MySecurityType.Name & "]" & vbTab & IIf(MyModel.Logical, "Attribute:" & vbTab & MyAttribute.AttributeName, "Column:" & vbTab & MyAttribute.ColumnName)

					について Each MySecurityProperty In MySecurityType.SecurityProperties
	
						MyAttribute.BoundSecurityProperties.Add(MySecurityProperty.ID)
	
					次のページ

				次のページ
	
			終了 もし

		次のページ

	次のページ

	' Bind Views' Data Security Infomartion
	について Each MyView In MyModel.Views
		
		Debug.プリント "View:" & vbTab & MyView.Name

		について Each MySecurityType In MyDictionary.SecurityTypes
			
			もし IsMatching(MySecurityType.Name, VIEWS) では
				
				について Each MySecurityProperty In MySecurityType.SecurityProperties
	
					MyView.BoundSecurityProperties.Add(MySecurityProperty.ID)
	
				次のページ

			終了 もし

		次のページ

	次のページ

	' Bind Business Data Objects' Data Security Infomartion
	について Each MyBusinessDataObject In MyModel.BusinessDataObjects
		
		Debug.プリント "BDO:" & vbTab & IIf(MyModel.Logical, MyBusinessDataObject.LogicalName, MyBusinessDataObject.PhysicalName)

		について Each MySecurityType In MyDictionary.SecurityTypes
			
			もし IsMatching(MySecurityType.Name, BUSINESSDATAOBJECTS) では
				
				について Each MySecurityProperty In MySecurityType.SecurityProperties
	
					MyBusinessDataObject.BoundSecurityProperties.Add(MySecurityProperty.ID)
	
				次のページ

			終了 もし

		次のページ

	次のページ

	デバッグ。.Print

End Sub

Public 機能 IsMatching(theAttachmentType$, theObjectType$) として ブーリアン
	
	薄暗い rc として ブーリアン, i%
	薄暗い names$()

	rc = UCase(theObjectType) = UCase(theAttachmentType)

	もし Not rc では

		names = Split(theAttachmentType, DELIMITER)
		について i = LBound(names) へ UBound(names)
			
			rc = (UCase(names(i)) = UCase(theObjectType))

			もし rc では
				
				出口 について

			終了 もし

		次のページ i

	終了 もし

	IsMatching = rc

終了 Function

Public 機能 ToImportExport(name$) として ブーリアン
	
	薄暗い rc として ブーリアン, i%
	薄暗い names$()

	rc = InStr(DELIMITER & UCase(ENTITIES) & DELIMITER & UCase(TABLES) & DELIMITER & UCase(ATTRIBUTES) & DELIMITER & UCase(COLUMNS) & DELIMITER & UCase(RELATIONSHIPS) & DELIMITER & UCase(VIEWS) & DELIMITER & UCase(MODELS) & DELIMITER & UCase(SUBMODELS) & DELIMITER & UCase(BUSINESSDATAOBJECTS) & DELIMITER, DELIMITER & UCase(name) & DELIMITER) > 0

	もし Not rc では

		names = Split(name, DELIMITER)
		について i = LBound(names) へ UBound(names)
			
			rc = (UCase(names(i)) = UCase(ENTITIES)) あるいは (UCase(names(i)) = UCase(TABLES)) あるいは (UCase(names(i)) = UCase(ATTRIBUTES)) あるいは (UCase(names(i)) = UCase(COLUMNS)) あるいは (UCase(names(i)) = UCase(RELATIONSHIPS)) あるいは (UCase(names(i)) = UCase(VIEWS)) あるいは (UCase(names(i)) = UCase(MODELS)) あるいは (UCase(names(i)) = UCase(SUBMODELS)) あるいは (UCase(names(i)) = UCase(BUSINESSDATAOBJECTS))

			もし rc では
				
				出口 について

			終了 もし

		次のページ i

	終了 もし

	ToImportExport = rc

終了 Function

Public サブ FilterTypes(ByRef MyAttachmentType として AttachmentType, sValue$)
	
	薄暗い MyValidAttachmentBinding として ValidAttachmentBinding
	薄暗い rc として ブーリアン, i%, sType$
	薄暗い names$()

	' Remove the existing bindings
	について Each MyValidAttachmentBinding In MyAttachmentType.ValidAttachmentBindings
		
		MyAttachmentType.ValidAttachmentBindings.Remove(MyValidAttachmentBinding.ID)

	次のページ

	sType = GetVABType(sValue)

	もし sType <> "" では
		
		MyAttachmentType.ValidAttachmentBindings.Add(sType)

	その他
		
		names = Split(sValue, DELIMITER)
		について i = LBound(names) へ UBound(names)
			
			sType = GetVABType(names(i))

			もし sType <> "" では
			
				MyAttachmentType.ValidAttachmentBindings.Add(sType)
				Debug.プリント "VAB:" & vbTab & MyAttachmentType.Name & vbTab & vbTab & sType

			終了 もし

		次のページ i

	終了 もし

	MyAttachmentType.ValidAttachmentBindings.Remove("Universal Mappings")	'	The last one remaining from the remove all at the start; as we don't handle Universal Mappings, we remove it after adding the one(s) we need

終了 サブ

プライベート 機能 GetVABType$(sType$)
	
	薄暗い rc$

	rc = ""

	Select Case UCase(sType)
		Case UCase(ENTITIES), UCase(TABLES)
			rc = VAB_ENTITIES_TABLES
		Case UCase(ATTRIBUTES), UCase(COLUMNS)
			rc = VAB_ATTRIBUTES_COLUMNS
		Case UCase(RELATIONSHIPS)
			rc = VAB_RELATIONSHIPS
		Case UCase(VIEWS)
			rc = VAB_VIEWS
		Case UCase(MODELS)
			rc = VAB_MODELS
		Case UCase(SUBMODELS)
			rc = VAB_SUBMODELS
		Case UCase(BUSINESSDATAOBJECTS)
			rc = VAB_BUSINESSDATAOBJECTS
	終了 Select

	GetVABType = rc

終了 機能

wGeneratePropertiesToExcel.bas

'#Language "WWB-COM"
''MACRO TITLE: wGenerate Properties to Excel
' MACRO VERSION: 3.0
'This macro exports specific Attachments and Data Security Information
'	for Entities, Tables, Attributes, Columns, Relationships, Views,
'	Models, Submodels & Business Data Objects
'
' Dependencies
'	wBindPropertiesToERObjects.bas
'	Excel
'
' Release notes
' 3.0: Export specific Data Security Information
' 2.0: Export specific Attachments Types
' 1.0: Initial version
'---------------------------------------------------------------------------
'#Uses "wBindPropertiesToERObjects.bas"

オプション Explicit

Private コンスト TITLE$ = "wGenerate Properties to Excel"
プライベート コンスト TIMESTAMPED として ブーリアン = True

Sub メイン

	薄暗い MyDiagram として ダイアグラム
	薄暗い MyDictionary として Dictionary
	薄暗い dictionary_list$()
	
	薄暗い MyAttachmentType として AttachmentType
	薄暗い MyAttachment として Attachment
	薄暗い MySecurityType として SecurityType
	薄暗い MySecurityProperty として SecurityProperty

	' Excel variables
	薄暗い wb として 対象
	薄暗い シート として 対象
	薄暗い excel として 対象

	薄暗い MyListMember として ListMember
	薄暗い sList$
	薄暗い curRow%

	Debug.クリア

	'Get the current diagram.
	セット MyDiagram = DiagramManager.ActiveDiagram

	もし Not MyDiagram そうなのか? 何もない では
		' Excel
		セット excel = オブジェクトの作成("excel.application")
	
		PrintHeader(excel, wb, sheet)
		' Excel optimization
		excel.Application.ScreenUpdating = False
		excel.Application.EnableAnimations = False
		excel.Application.Calculation = xlCalculationManual
		sheet.DisplayPageBreaks = False
	
		curRow = 2
	
		もし init_dictionary_list(MyDiagram, dictionary_list) では
			
			セット MyDictionary = MyDiagram.Dictionary
	
		その他
			
			開始 Dialog UserDialog 550,130,TITLE ' %grid:10,7,1,1
				Text 30,21,120,14,"Select Dictionary: ",.Text3,1
				DropListBox 170,18,360,112,dictionary_list(),.dictionary_select
				OKButton 20,105,110,21
				CancelButton 420,105,110,21
			終了 ダイアログ
	
			薄暗い dlg として ユーザーダイアログ
	
			もし ダイアログ(dlg) = -1 では
				
				もし dictionary_list(dlg.dictionary_select) = "Local" では
					
					セット MyDictionary = MyDiagram.Dictionary
	
				その他
					
					セット MyDictionary = MyDiagram.EnterpriseDataDictionaries.Item(dictionary_list(dlg.dictionary_select))
	
				終了 もし
	
			その他
				
				出口 サブ
	
			終了 もし
	
		終了 もし
		
		もし Not MyDictionary そうなのか? 何もない では
	
			LogIt "Dictionary: " & MyDictionary.Name
	
			' Get all attachments
			について Each MyAttachmentType In MyDictionary.AttachmentTypes
				
				' Export only the needed attachments
				もし ToImportExport(MyAttachmentType.Name) では
					
					について Each MyAttachment In MyAttachmentType.Attachments
						
			'			LogIt MyAttachmentType.Name & " / " & MyAttachment.Name
						sheet.Cells(curRow, 1).Value = MyAttachmentType.Name
						sheet.Cells(curRow, 2).Value = MyAttachment.Name
						sheet.Cells(curRow, 3).Value = MyAttachment.Description
						sheet.Cells(curRow, 4).Value = MyAttachment.Datatype
						sheet.Cells(curRow, 5).Value = MyAttachment.ValueDefault
		
						Select Case MyAttachment.Datatype
		
							Case TEXT_LIST_TYPE
								sList = ""
		
								について Each MyListMember In MyAttachment.TextList
		
									sList += MyListMember.Text & ","
		
								次のページ MyListMember
		
								もし Right(sList, 1) = "," では
									
									sList = Left(sList, Len(sList) - 1)
		
								終了 もし
		
								sheet.Cells(curRow, 6).Value = sList
		
						終了 Select
			
		'				XLColumns4Attachments(MyAttachmentType.Name & "\" & MyAttachment.Name) = curCol
						LogIt MyAttachmentType.Name & "\" & MyAttachment.Name
						curRow += 1
		
					次のページ MyAttachment
	
				その他
					
					LogIt "SKIPPED:" & vbTab & MyAttachmentType.Name
	
				終了 もし
	
			次のページ MyAttachmentType
		
			curRow = 2
			' Select the Data Security Information sheet
			セット sheet = wb.worksheets(XL_TAB_SECURITY)
			sheet.Activate
	
			' Get all data security information
			について Each MySecurityType In MyDictionary.SecurityTypes
				
				' Export only the needed data security information
				もし ToImportExport(MySecurityType.Name) では
					
					について Each MySecurityProperty In MySecurityType.SecurityProperties
						
			'			LogIt MySecurityType.Name & " / " & MySecurityProperty.Name
						sheet.Cells(curRow, 1).Value = MySecurityType.Name
						sheet.Cells(curRow, 2).Value = MySecurityProperty.Name
						sheet.Cells(curRow, 3).Value = MySecurityProperty.Description
						sheet.Cells(curRow, 4).Value = MySecurityProperty.Datatype
						sheet.Cells(curRow, 5).Value = MySecurityProperty.ValueDefault
		
						Select Case MySecurityProperty.Datatype
		
							Case TEXT_LIST_TYPE
								sList = ""
		
								について Each MyListMember In MySecurityProperty.TextList
		
									sList += MyListMember.Text & ","
		
								次のページ MyListMember
		
								もし Right(sList, 1) = "," では
									
									sList = Left(sList, Len(sList) - 1)
		
								終了 もし
		
								sheet.Cells(curRow, 6).Value = sList
		
						終了 Select
			
		'				XLColumns4Attachments(MyAttachmentType.Name & "\" & MyAttachment.Name) = curCol
						LogIt MySecurityType.Name & "\" & MySecurityProperty.Name
						curRow += 1
		
					次のページ MySecurityProperty
	
				その他
					
					LogIt "SKIPPED:" & vbTab & MySecurityType.Name
	
				終了 もし
	
			次のページ MySecurityType
	
			Debug.プリント
			LogIt "Export completed"
		
			excel.Visible = 真
			excel.Application.ScreenUpdating = 真
			excel.Application.EnableAnimations = 真
			excel.Application.Calculation = xlCalculationAutomatic
	'		sheet.DisplayPageBreaks = True
			AutofitAllUsed(excel)
			' Select the Attachment sheet
			セット sheet = wb.worksheets(XL_TAB_ATTACHMENT)
			sheet.Activate
			AutofitAllUsed(excel)
	'		sheet.Rows("1:1").RowHeight = 14.4 '.EntireRow.AutoFit
	
			MsgBox "Export completed !", vbInformation, TITLE

		終了 もし

	その他
		
		MsgBox "No project opened!", vbExclamation, TITLE

	終了 もし
	
終了 サブ

プライベート 機能 PrefixDT(txt として ストリング) として ストリング
	もし TIMESTAMPED では
		PrefixDT = CStr(現在) & Chr(9) & txt
	その他
		PrefixDT = txt
	終了 If
End 機能

プライベート サブ LogIt(ByVal txt として ストリング)

	Debug.プリント PrefixDT(txt)

終了 サブ

プライベート サブ PrintHeader(ByRef excel として 対象, ByRef wb として 対象, ByRef シート として 対象)

	セット wb = excel.workbooks.Add

	' Attachments
	セット sheet = wb.activesheet

	sheet.Name = XL_TAB_ATTACHMENT

	と sheet.range("A1:F1")
		.interior.colorindex = 15
		.font.Size = 9
		.font.Bold = 真
		.horizontalalignment = xlCenter
	終了 と

	と excel
		と .ActiveWindow
			.SplitColumn = 1
			.SplitRow = 1
		終了 と
		.ActiveWindow.FreezePanes = 真
	終了 と

	sheet.cells(1,1).Value = "Attachment Type"
	sheet.cells(1,2).Value = "Name"
	sheet.cells(1,3).Value = "Description"
	sheet.cells(1,4).Value = "Data Type"
	sheet.cells(1,5).Value = "Default value"
	sheet.cells(1,6).Value = "Text list values"

	と sheet.cells(1,4)
		.AddComment
		.Comment.Visible = False
		.Comment.Text Text:= "1 = Boolean" & vbCrLf & "2 = Date" & vbCrLf & "3 = ExternalFilePath" & vbCrLf & "4 = Numeric" & vbCrLf & "5 = Text" & vbCrLf & "6 = TextList" & vbCrLf & "7 = Time"
	終了 と

	と sheet.range("A:A")
		.interior.colorindex = 15
		.verticalalignment = xlBottom
		.horizontalalignment = xlLeft
		.font.Bold = 真
		.font.Size = 9
	終了 と

	Comments_AutoSize(sheet)

	' Data Security Information
	セット sheet = wb.worksheets.Add(After:=sheet)

	sheet.Name = XL_TAB_SECURITY

	と sheet.range("A1:F1")
		.interior.colorindex = 15
		.font.Size = 9
		.font.Bold = 真
		.horizontalalignment = xlCenter
	終了 と

	と excel
		と .ActiveWindow
			.SplitColumn = 1
			.SplitRow = 1
		終了 と
		.ActiveWindow.FreezePanes = 真
	終了 と

	sheet.cells(1,1).Value = "Security Type"
	sheet.cells(1,2).Value = "Name"
	sheet.cells(1,3).Value = "Description"
	sheet.cells(1,4).Value = "Data Type"
	sheet.cells(1,5).Value = "Default value"
	sheet.cells(1,6).Value = "Text list values"

	と sheet.cells(1,4)
		.AddComment
		.Comment.Visible = False
		.Comment.Text Text:= "1 = Boolean" & vbCrLf & "2 = Date" & vbCrLf & "3 = ExternalFilePath" & vbCrLf & "4 = Numeric" & vbCrLf & "5 = Text" & vbCrLf & "6 = TextList" & vbCrLf & "7 = Time"
	終了 と

	と sheet.range("A:A")
		.interior.colorindex = 15
		.verticalalignment = xlBottom
		.horizontalalignment = xlLeft
		.font.Bold = 真
		.font.Size = 9
	終了 と

	Comments_AutoSize(sheet)

	' Select the Attachment sheet
	セット sheet = wb.worksheets(XL_TAB_ATTACHMENT)
	sheet.Activate

終了 サブ

プライベート サブ AutofitAllUsed(excel として 対象)
	薄暗い x として Long

	について x = 1 へ excel.ActiveSheet.UsedRange.Columns.Count
		excel.ActiveSheet.UsedRange.Columns(x).EntireColumn.AutoFit
	次のページ x
終了 サブ

'initialize the dictionary drop down list
機能 init_dictionary_list(ByRef MyDiagram として Diagram, ByRef dictionary_list$()) として ブーリアン

	薄暗い i%
	薄暗い MyDictionary として Dictionary

	ReDim dictionary_list$(0 へ MyDiagram.EnterpriseDataDictionaries.Count)

	dictionary_list (0) = "Local"
	i = 1

	について Each MyDictionary In MyDiagram.EnterpriseDataDictionaries
		dictionary_list (i) = MyDictionary.Name
		i +=  1
	次のページ

	init_dictionary_list = MyDiagram.EnterpriseDataDictionaries.Count = 0

終了 Function

Sub Comments_AutoSize(s として 対象)
	' https://www.contextures.com/xlcomments03.html
	薄暗い MyComments として 対象
	薄暗い lArea として Long
	薄暗い lMult として Double
	薄暗い MaxW として Long
	薄暗い NewW として Long
	
	'Height adjustment factor
	 'of 1.1 seems to work ok.
	lMult = 1.1
	MaxW = 300
	NewW = 200
	
	について Each MyComments In s.Comments
	  と MyComments
		.Shape.TextFrame.AutoSize = 真
		もし .Shape.Width > MaxW では
		  lArea = .Shape.Width * .Shape.Height
		  .Shape.Width = NewW
		  .Shape.Height = (lArea / NewW) * lMult
		終了 もし
	  終了 と
	次のページ ' comment
終了 サブ

wReadPropertiesFromExcelWithUI.bas

'#Language "WWB-COM"
''MACRO TITLE: wRead Properties from Excel with UI
' MACRO VERSION: 3.0
'This macro imports specific Attachments and Data Security Information
'	for Entities, Tables, Attributes, Columns, Relationships, Views,
'	Models, Submodels & Business Data Objects
'
' Dependencies:
'	wBindPropertiesToERObjects.bas
'	Excel
'
' Known limitations
'	Types for Attachments & Data Security Information can NOT have common
'	names
'
' Release notes
' 3.0: Import specific Data Security Information
' 2.0: Import specific Attachments Types
' 1.0: Initial version
'---------------------------------------------------------------------------
'#Uses "wBindPropertiesToERObjects.bas"

オプション Explicit

Private コンスト TITLE$ = "wRead Properties from Excel"

薄暗い XLfile$
薄暗い lCurRow%

サブ メイン

	薄暗い excel として 対象
	薄暗い MyDiagram として ダイアグラム
	薄暗い MyDictionary として Dictionary
	薄暗い lNbAttachmentsManaged&, lNbSecurityPropertiesManaged&
	薄暗い dictionary_list$()
	Debug.クリア

	セット MyDiagram = DiagramManager.ActiveDiagram

	もし Not MyDiagram そうなのか? 何もない では

		開始 Dialog UserDialog 550,217,TITLE,.DialogFunc ' %grid:10,7,1,1
			Text 30,21,120,14,"Select Dictionary: ",.Text3,1
			DropListBox 170,18,360,112,dictionary_list(),.dictionary_select
			GroupBox 20,56,510,98,"Excel spreadsheet",.gbPath
			Text 30,84,50,14,"Path: ",.Text1,1
			TextBox 90,83,360,21,.Path
			PushButton 460,84,60,21,"Browse",.Browse
			PushButton 350,119,170,28,"Generate a Sample Sheet",.SampleSheet
			CheckBox 30,161,490,14,"Bind attachments to ER Objects",.cbBind
			OKButton 20,189,110,21
			CancelButton 420,189,110,21
		終了 ダイアログ
	
		薄暗い dlg として UserDialog
	
		init_dictionary_list(MyDiagram, dictionary_list)
	
		start_dialog:
		'dlg.Path = "C:\Users\William\Documents\ERStudio Data Architect 19.3\tests\GIM_Attachments.xlsx"
	
		'開始ダイアログ
		もし ダイアログ(dlg) = -1 では
	
			もし dictionary_list(dlg.dictionary_select) = "Local" では
				セット MyDictionary = MyDiagram.Dictionary
			その他
				セット MyDictionary = MyDiagram.EnterpriseDataDictionaries.Item(dictionary_list(dlg.dictionary_select))
			終了 もし
	
			'エクセルオブジェクトを初期化し、可視化する
			セット excel = オブジェクトの作成("Excel.Application")
	
			'this Error Is For an errant file path, Dialog will be restarted
			オン エラー GoTo Error_open
	
			XLfile = dlg.Path
			excel.workbooks.オープン XLfile
		
			オン エラー GoTo Error_unknown
	
			DiagramManager.EnableScreenUpdateEx(False, False)
	
			lNbAttachmentsManaged = ImportAttachments(excel, MyDictionary)
			lNbSecurityPropertiesManaged = ImportSecurities(excel, MyDictionary)
	
			もし ((lNbAttachmentsManaged > 0) あるいは (lNbSecurityPropertiesManaged > 0)) そして dlg.cbBind では
				
				BindProperties(False)
	
			終了 もし
	
			DiagramManager.EnableScreenUpdateEx(真, 真)
	
			excel.Quit()
			MsgBox ("ERObjects properties imported" & vbCrLf & vbCrLf & lNbAttachmentsManaged & " attachment" & もし(lNbAttachmentsManaged > 1, "s", "") & " managed" & vbCrLf & lNbSecurityPropertiesManaged & " security propert" & もし(lNbSecurityPropertiesManaged > 1, "ies", "y") & " managed", vbInformation, TITLE)
			Debug.プリント
			デバッグ。.プリント lNbAttachmentsManaged & " attachment" & もし(lNbAttachmentsManaged > 1, "s", "") & " managed"
			Debug.プリント lNbSecurityPropertiesManaged & " security propert" & もし(lNbSecurityPropertiesManaged > 1, "ies", "y") & " managed"
	
			出口 サブ
		
			Error_open:
				MsgBox("Please enter a valid path.", vbExclamation, TITLE)
				GoTo start_dialog
	
			Error_unknown:
				MsgBox(エラー.Description & もし(lCurRow > 1, vbCrLf & vbCrLf & "Last Excel row used: " & lCurRow, ""), vbExclamation, TITLE)
			
				もし Not excel そうなのか? 何もない では
					excel.Quit()
				終了 もし
	
				DiagramManager.EnableScreenUpdateEx(真, 真)
	
		終了 もし

	その他
		
		MsgBox "No project opened!", vbExclamation, TITLE

	終了 もし

終了 サブ

'initialize the dictionary drop down list
サブ init_dictionary_list(ByRef MyDiagram として Diagram, ByRef dictionary_list$())

	薄暗い i%
	薄暗い MyDictionary として Dictionary

	ReDim dictionary_list$(0 へ MyDiagram.EnterpriseDataDictionaries.Count)

	dictionary_list (0) = "Local"
	i = 1

	について Each MyDictionary In MyDiagram.EnterpriseDataDictionaries
		dictionary_list (i) = MyDictionary.Name
		i = i + 1
	Next

End サブ

プライベート 機能 ImportAttachments%(ByRef ex として Variant, ByRef MyDictionary として Dictionary)

	薄暗い シート として 対象
	薄暗い 範囲 として 対象

	薄暗い sValue$, iValue%, sDefault$
	薄暗い lNbAttachments&, lNbAttachmentsManaged&

	薄暗い MyAttachmentType として AttachmentType
	薄暗い MyAttachment として Attachment
	
	薄暗い sLastAttachmentType$

	薄暗い sDescription$, dt として Date, splitted$()

	セット sheet = ex.worksheets(XL_TAB_ATTACHMENT)
	sheet.Activate
	セット range = sheet.usedrange
	range.Select
	sLastAttachmentType = ""

	ImportAttachments = 0

	lNbAttachments = range.Rows.Count
	Debug.プリント "Number of attachments: " & (lNbAttachments - 1)
	lNbAttachmentsManaged = 0

	ReDim MyAttachments(lNbAttachments)

	について lCurRow = 2 へ lNbAttachments
		sValue = トリム(CStr(range.Cells(lCurRow, 1).Value))
		もし (sValue <> "") そして ToImportExport(sValue) では
			もし (sValue <> sLastAttachmentType) では
				セット MyAttachmentType = MyDictionary.AttachmentTypes(sValue)
				' Check if AttachmentType exists
				もし MyAttachmentType そうなのか? 何もない では
					' Attachment type not found, we create it
					セット MyAttachmentType = MyDictionary.AttachmentTypes.Add(sValue, "Imported from file: " & XLfile)
					' Filter types: ValidAttachmentBinding.ObjectType
					FilterTypes(MyAttachmentType, sValue)
				終了 もし
				sLastAttachmentType = sValue
			終了 もし

			値 トリム(CStr(range.Cells(lCurRow, 2).Value))
			もし (sValue <> "") では
				セット MyAttachment = MyAttachmentType.Attachments(sValue)
				' Check if Attachment exists
				もし MyAttachment そうなのか? 何もない では
					' Attachment not found, we create it
					セット MyAttachment = MyAttachmentType.Attachments.Add(sValue,  "Imported from file: " & XLfile, "", TEXT_TYPE)
					Debug.プリント "Attachment created: " & MyAttachmentType.Name & " \ " & MyAttachment.Name
				その他
					デバッグ。.プリント "Attachment found: " & MyAttachmentType.Name & " \ " & MyAttachment.Name
				終了 もし

				lNbAttachmentsManaged += 1

				sDescription = トリム(CStr(range.Cells(lCurRow, 3).Value))

				もし sDescription <> "" では
				
					MyAttachment.Description = sDescription

				終了 もし

				iValue = CInt(トリム(range.Cells(lCurRow, 4).Value))

				MyAttachment.Datatype = iValue

				sValue = トリム(CStr(range.Cells(lCurRow, 6).Value))

				もし sValue <> "" では
				
					splitted = Split(sValue, ",")

					について Each sValue In splitted

						MyAttachment.TextList.Add(sValue)

					次のページ 値

				終了 もし

				sDefault = トリム(CStr(range.Cells(lCurRow, 5).Value))

				もし (sDefault <> "") では
					
					' Convert/Format the value to a string
					Select Case iValue

					Case NUMERIC_TYPE
						
						sDefault = CStr(CInt(sDefault))

					Case DATE_TYPE
						
						dt = CStr(CDate(sDefault))
						sDefault = フォーマット(dt, "MM/DD/YYYY")

					Case TIME_TYPE
						
						dt = CStr(CDate(sDefault)) ' Type checking through casting
						sDefault = フォーマット(dt, "hh:nn:ssAMPM") ' Expected ER/Studio format

					Case BOOLEAN_TYPE
						
						sDefault = CStr(CBool(sDefault))

					終了 Select

					MyAttachment.ValueDefault = sDefault

				終了 もし

			終了 もし

		終了 もし
	次のページ lCurRow

	ImportAttachments = lNbAttachmentsManaged

終了 Function

Sub PrintSampleSheet()
	薄暗い sample として 対象
	薄暗い wb, ws として Variant

	セット sample = オブジェクトの作成("excel.application")
	sample.visible = 真

	セット wb = sample.workbooks.Add
	セット ws = wb.activesheet

	PrintHeader(sample, wb, ws)

	ws.Cells(2, 1).Value = "Tables"
	ws.Cells(2, 2).Value = "Attachment 1"
	ws.Cells(2, 3).Value = "A description"
	ws.Cells(2, 4).Value = TEXT_TYPE
	ws.Cells(2, 5).Value = "Default value"

	ws.Cells(3, 1).Value = "Tables"
	ws.Cells(3, 2).Value = "Attachment 2"
	ws.Cells(3, 3).Value = "Another description"
	ws.Cells(3, 4).Value = TEXT_LIST_TYPE
	ws.Cells(3, 5).Value = "Second item"
	ws.Cells(3, 6).Value = "First item,Second item,Third item"

	ws.Cells(4, 1).Value = "Entities"
	ws.Cells(4, 2).Value = "Attachment 1"
	ws.Cells(4, 3).Value = "My entity property description"
	ws.Cells(4, 4).Value = TEXT_TYPE

	ws.Cells(5, 1).Value = "Attributes|Columns"
	ws.Cells(5, 2).Value = "Attachment 1"
	ws.Cells(5, 3).Value = "My Attribute or Column property description"
	ws.Cells(5, 4).Value = TEXT_TYPE

	ws.Cells(6, 1).Value = "Attributes|Columns"
	ws.Cells(6, 2).Value = "Attachment 2"
	ws.Cells(6, 3).Value = "My Attribute or Column property description"
	ws.Cells(6, 4).Value = TEXT_TYPE

	ws.Cells(7, 1).Value = "..."
	ws.Cells(7, 2).Value = "..."
	ws.Cells(7, 3).Value = "..."
	ws.Cells(7, 4).Value = "..."
	ws.Cells(7, 5).Value = "..."
	ws.Cells(7, 6).Value = "..."

	AutofitAllUsed(sample)

	' Select the Data Security Information sheet
	セット ws = wb.worksheets(XL_TAB_SECURITY)
	ws.Activate

	ws.Cells(2, 1).Value = "Tables|Entities|Attributes|Columns"
	ws.Cells(2, 2).Value = "Property 1"
	ws.Cells(2, 3).Value = "A description"
	ws.Cells(2, 4).Value = TEXT_TYPE
	ws.Cells(2, 5).Value = "Default value"

	ws.Cells(3, 1).Value = "Tables|Entities|Attributes|Columns"
	ws.Cells(3, 2).Value = "Property 2"
	ws.Cells(3, 3).Value = "Another description"
	ws.Cells(3, 4).Value = TEXT_LIST_TYPE
	ws.Cells(3, 5).Value = "Second item"
	ws.Cells(3, 6).Value = "First item,Second item,Third item"

	ws.Cells(4, 1).Value = "Relationships"
	ws.Cells(4, 2).Value = "Attachment 1"
	ws.Cells(4, 3).Value = "My entity property description"
	ws.Cells(4, 4).Value = TEXT_TYPE

	ws.Cells(5, 1).Value = "..."
	ws.Cells(5, 2).Value = "..."
	ws.Cells(5, 3).Value = "..."
	ws.Cells(5, 4).Value = "..."
	ws.Cells(5, 5).Value = "..."
	ws.Cells(5, 6).Value = "..."

	AutofitAllUsed(sample)

	' Select the Attachments sheet
	セット ws = wb.worksheets(XL_TAB_ATTACHMENT)
	ws.Activate

	Debug.プリント "Sample generated"
	MsgBox "Sample generated", vbInformation, TITLE
終了 サブ

プライベート 機能 DialogFunc(DlgItem$, Action%, SuppValue&) として ブーリアン
	Select Case Action%
	Case 1 ' Dialog box initialization
		
		DlgValue("cbBind", 真)

	Case 2 '値の変更またはボタンの押下
		
		もし DlgItem = "ブラウズ" では
			'ブラウズボタンを使用する場合は、エクセルファイルをブラウズする。  テキストボックスにパスを入れる。.
			DlgText "path", GetFilePath(, "すべてのExcelファイル(*.xlsx;*.xls;*.xlsm)|*.xlsx;*.xls;*.xlsm|Excelワークブック(*.xlsx)|*.xlsx|Excelマクロ対応ワークブック(*.xslm)|*.xslm|Excel 97-2003ワークブック(*.xls)|*.xls|すべてのファイル(*.*)|*.*",, "Open SpreadSheet", 0)
			DialogFunc = 真
		ElseIf DlgItem = "SampleSheet" では
			PrintSampleSheet
			DialogFunc = 真
		ElseIf DlgItem = "OK" そして DlgText("path") = "" では
			'パスが指定されていない場合、ダイアログを終了しない。
			MsgBox("Please enter a valid path.", vbExclamation, TITLE)
			DialogFunc = 真
		終了 もし
		Rem DialogFunc = True ' Prevent button press from closing the dialog box

	Case 3 ' TextBox or ComboBox text changed
	Case 4 ' Focus changed
	Case 5 ' Idle
		Rem DialogFunc = True ' Continue getting idle actions
	Case 6 ' Function key
	終了 Select
End 機能

プライベート サブ AutofitAllUsed(excelObj)
	薄暗い x として Long

	について x = 1 へ excelObj.ActiveSheet.UsedRange.Columns.Count
		excelObj.ActiveSheet.UsedRange.Columns(x).EntireColumn.AutoFit
	次のページ x
終了 サブ

プライベート サブ PrintHeader(excel として 対象, wb として Variant, sheet として Variant)

	sheet.Name = "Attachments"

	と sheet.range("A1:F1")
		.interior.colorindex = 15
		.font.Size = 9
		.font.Bold = 真
		.horizontalalignment = xlCenter
	終了 と

	と excel
		と .ActiveWindow
			.SplitColumn = 1
			.SplitRow = 1
		終了 と
		.ActiveWindow.FreezePanes = 真
	終了 と

	sheet.cells(1,1).Value = "Attachment Type"
	sheet.cells(1,2).Value = "Name"
	sheet.cells(1,3).Value = "Description"
	sheet.cells(1,4).Value = "Data Type"
	sheet.cells(1,5).Value = "Default value"
	sheet.cells(1,6).Value = "Text list values"

	と sheet.cells(1,4)
		.AddComment
		.Comment.Visible = False
		.Comment.Text Text:= "1 = Boolean" & vbCrLf & "2 = Date" & vbCrLf & "3 = ExternalFilePath" & vbCrLf & "4 = Numeric" & vbCrLf & "5 = Text" & vbCrLf & "6 = TextList" & vbCrLf & "7 = Time"
	終了 と

	と sheet.range("A:A")
		.interior.colorindex = 15
		.verticalalignment = xlBottom
		.horizontalalignment = xlLeft
		.font.Bold = 真
		.font.Size = 9
	終了 と

	Comments_AutoSize(sheet)

	' Data Security Information
	セット sheet = wb.worksheets.Add(After:=sheet)

	sheet.Name = XL_TAB_SECURITY

	と sheet.range("A1:F1")
		.interior.colorindex = 15
		.font.Size = 9
		.font.Bold = 真
		.horizontalalignment = xlCenter
	終了 と

	と excel
		と .ActiveWindow
			.SplitColumn = 1
			.SplitRow = 1
		終了 と
		.ActiveWindow.FreezePanes = 真
	終了 と

	sheet.cells(1,1).Value = "Security Type"
	sheet.cells(1,2).Value = "Name"
	sheet.cells(1,3).Value = "Description"
	sheet.cells(1,4).Value = "Data Type"
	sheet.cells(1,5).Value = "Default value"
	sheet.cells(1,6).Value = "Text list values"

	と sheet.cells(1,4)
		.AddComment
		.Comment.Visible = False
		.Comment.Text Text:= "1 = Boolean" & vbCrLf & "2 = Date" & vbCrLf & "3 = ExternalFilePath" & vbCrLf & "4 = Numeric" & vbCrLf & "5 = Text" & vbCrLf & "6 = TextList" & vbCrLf & "7 = Time"
	終了 と

	と sheet.range("A:A")
		.interior.colorindex = 15
		.verticalalignment = xlBottom
		.horizontalalignment = xlLeft
		.font.Bold = 真
		.font.Size = 9
	終了 と

	Comments_AutoSize(sheet)

	' Select the Attachment sheet
	セット sheet = wb.worksheets(XL_TAB_ATTACHMENT)
	sheet.Activate

終了 Sub

Sub Comments_AutoSize(s として 対象)
	' https://www.contextures.com/xlcomments03.html
	薄暗い MyComments として 対象
	薄暗い lArea として Long
	薄暗い lMult として Double
	薄暗い MaxW として Long
	薄暗い NewW として Long
	
	'Height adjustment factor
	 'of 1.1 seems to work ok.
	lMult = 1.1
	MaxW = 300
	NewW = 200
	
	について Each MyComments In s.Comments
	  と MyComments
		.Shape.TextFrame.AutoSize = 真
		もし .Shape.Width > MaxW では
		  lArea = .Shape.Width * .Shape.Height
		  .Shape.Width = NewW
		  .Shape.Height = (lArea / NewW) * lMult
		終了 もし
	  終了 と
	次のページ ' comment
終了 サブ

プライベート 機能 ImportSecurities%(ByRef ex として Variant, ByRef MyDictionary として Dictionary)

	薄暗い シート として 対象
	薄暗い 範囲 として 対象

	薄暗い lNbSecurityProperties&

	薄暗い sValue$, iValue%, sDefault$
	薄暗い lNbSecuritiesManaged&

	薄暗い MySecurityType として SecurityType
	薄暗い MySecurityProperty として SecurityProperty

	薄暗い sLastSecurityType$

	薄暗い sDescription$, dt として Date, splitted$()

	セット sheet = ex.worksheets(XL_TAB_SECURITY)
	sheet.Activate
	セット range = sheet.usedrange
	range.Select
	sLastSecurityType = ""

	ImportSecurities = 0

	lNbSecurityProperties = range.Rows.Count
	Debug.プリント "Number of data security information: " & (lNbSecurityProperties - 1)
	lNbSecuritiesManaged = 0

	について lCurRow = 2 へ lNbSecurityProperties
		sValue = トリム(CStr(range.Cells(lCurRow, 1).Value))
		もし (sValue <> "") そして ToImportExport(sValue) では
			もし (sValue <> sLastSecurityType) では
				セット MySecurityType = MyDictionary.SecurityTypes(sValue)
				' Check if Security Type exists
				もし MySecurityType そうなのか? 何もない では
					' Security type not found, we create it
					セット MySecurityType = MyDictionary.SecurityTypes.Add(sValue, "Imported from file: " & XLfile)
				終了 もし
				sLastSecurityType = sValue
			終了 もし

			値 トリム(CStr(range.Cells(lCurRow, 2).Value))
			もし (sValue <> "") では
				セット MySecurityProperty = MySecurityType.SecurityProperties(sValue)
				' Check if Security Property exists
				もし MySecurityProperty そうなのか? 何もない では
					' Security Property not found, we create it
					セット MySecurityProperty = MySecurityType.SecurityProperties.Add(sValue,  "Imported from file: " & XLfile, "", TEXT_TYPE)
					Debug.プリント "Security Property created: " & MySecurityType.Name & " \ " & MySecurityProperty.Name
				その他
					デバッグ。.プリント "Security Property found: " & MySecurityType.Name & " \ " & MySecurityProperty.Name
				終了 もし

				lNbSecuritiesManaged += 1

				sDescription = トリム(CStr(range.Cells(lCurRow, 3).Value))

				もし sDescription <> "" では
				
					MySecurityProperty.Description = sDescription

				終了 もし

				iValue = CInt(トリム(range.Cells(lCurRow, 4).Value))

				MySecurityProperty.Datatype = iValue

				sValue = トリム(CStr(range.Cells(lCurRow, 6).Value))

				もし sValue <> "" では
				
					splitted = Split(sValue, ",")

					について Each sValue In splitted

						MySecurityProperty.TextList.Add(sValue)

					次のページ 値

				終了 もし

				sDefault = トリム(CStr(range.Cells(lCurRow, 5).Value))

				もし (sDefault <> "") では
					
					' Convert/Format the value to a string
					Select Case iValue

					Case NUMERIC_TYPE
						
						sDefault = CStr(CInt(sDefault))

					Case DATE_TYPE
						
						dt = CStr(CDate(sDefault))
						sDefault = フォーマット(dt, "MM/DD/YYYY")

					Case TIME_TYPE
						
						dt = CStr(CDate(sDefault)) ' Type checking through casting
						sDefault = フォーマット(dt, "hh:nn:ssAMPM") ' Expected ER/Studio format

					Case BOOLEAN_TYPE
						
						sDefault = CStr(CBool(sDefault))

					終了 Select

					MySecurityProperty.ValueDefault = sDefault

				終了 もし

			終了 もし

		終了 もし
	次のページ lCurRow

	ImportSecurities = lNbSecuritiesManaged

終了 機能

wReadPropertiesFromExcel.bas

⚠️ You need to update the path to the Excel workbook (Line 26).

'#Language "WWB-COM"
''MACRO TITLE: wRead Properties from Excel
' MACRO VERSION: 3.0
'This macro imports specific Attachments for Entities, Tables, Attributes,
'	Columns, Relationships, Views, Models, Submodels & Business Data Objects
'
' Dependencies
'	wBindPropertiesToERObjects.bas
'	Excel
'
' Known limitations
'	Types for Attachments & Data Security Information can NOT have common
'	names
'
' Release notes
' 3.0: Import specific Data Security Information
' 2.0: Import specific Attachments Types
' 1.0: Initial version
'---------------------------------------------------------------------------
'#Uses "wBindPropertiesToERObjects.bas"

オプション Explicit

Private コンスト TITLE$ = "wRead Properties from Excel"

プライベート コンスト EXCEL_FILE$ = "C:\Users\William\Documents\ERStudio Data Architect 20.1\Tests\default_attachments_V3.xlsx"	'	Path to the workbook with the attachments list
プライベート コンスト BIND_PROPERTIES_TO_EROBJECTS = True

Dim lCurRow%

サブ メイン
	
	薄暗い excel として 対象

	薄暗い MyDiagram として ダイアグラム
	薄暗い MyDictionary として Dictionary

	薄暗い lNbAttachmentsManaged&, lNbSecurityPropertiesManaged&
	Debug.クリア

	セット MyDiagram = DiagramManager.ActiveDiagram

	もし Not MyDiagram そうなのか? 何もない では

		start_dialog:
	
		もし DICTIONARY_NAME = "" では
			セット MyDictionary = MyDiagram.Dictionary
		その他
			セット MyDictionary = MyDiagram.EnterpriseDataDictionaries.Item(DICTIONARY_NAME)
		終了 もし
	
		もし Not MyDictionary そうなのか? 何もない では
	
			'エクセルオブジェクトを初期化し、可視化する
			セット excel = オブジェクトの作成("Excel.Application")
		
			'this Error Is For an errant file path, Dialog will be restarted
			オン エラー GoTo Error_open
		
			excel.workbooks.オープン EXCEL_FILE
		
			オン エラー GoTo Error_unknown
		
			DiagramManager.EnableScreenUpdateEx(False, False)
		
			lNbAttachmentsManaged = ImportAttachments(excel, MyDictionary)
			lNbSecurityPropertiesManaged = ImportSecurities(excel, MyDictionary)
			lCurRow = 0
		
			もし ((lNbAttachmentsManaged > 0) あるいは (lNbSecurityPropertiesManaged > 0)) そして BIND_PROPERTIES_TO_EROBJECTS では
				
				BindProperties(False)
		
			終了 もし
		
			DiagramManager.EnableScreenUpdateEx(真, 真)
		
			excel.Quit()
			MsgBox ("ERObjects properties imported" & vbCrLf & vbCrLf & lNbAttachmentsManaged & " attachment" & もし(lNbAttachmentsManaged > 1, "s", "") & " managed" & vbCrLf & lNbSecurityPropertiesManaged & " security propert" & もし(lNbSecurityPropertiesManaged > 1, "ies", "y") & " managed", vbInformation, TITLE)
			Debug.プリント
			デバッグ。.プリント lNbAttachmentsManaged & " attachment" & もし(lNbAttachmentsManaged > 1, "s", "") & " managed"
			Debug.プリント lNbSecurityPropertiesManaged & " security propert" & もし(lNbSecurityPropertiesManaged > 1, "ies", "y") & " managed"
	
		その他
			
			MsgBox "Data dictionary not available!", vbExclamation, TITLE
	
		終了 もし

	その他
		
		MsgBox "No project opened!", vbExclamation, TITLE

	終了 もし

	出口 サブ

	Error_open:
		MsgBox("Excel file path is not valid.", vbExclamation, TITLE)
		GoTo start_dialog

	Error_unknown:
		MsgBox(エラー.Description & もし(lCurRow > 1, vbCrLf & vbCrLf & "Last Excel row used: " & lCurRow, ""), vbExclamation, TITLE)
	
		もし Not excel そうなのか? 何もない では
			excel.Quit()
		終了 もし

		DiagramManager.EnableScreenUpdateEx(真, 真)

終了 サブ

プライベート 機能 ImportAttachments(ByRef ex として Variant, ByRef dict として Dictionary) として 整数

	薄暗い シート として 対象
	薄暗い 範囲 として 対象

	薄暗い lNbAttachments&

	薄暗い sValue$, iValue%, sDefault$
	薄暗い lNbAttachmentsManaged&

	薄暗い MyAttachmentType として AttachmentType
	薄暗い MyAttachment として Attachment

	薄暗い sLastAttachmentType$

	薄暗い sDescription$, dt として Date, splitted$()

	セット sheet = ex.worksheets(XL_TAB_ATTACHMENT)
	sheet.Activate
	セット range = sheet.usedrange
	range.Select
	sLastAttachmentType = ""

	ImportAttachments = 0

	lNbAttachments = range.Rows.Count
	Debug.プリント "Number of attachments: " & (lNbAttachments - 1)
	lNbAttachmentsManaged = 0

	について lCurRow = 2 へ lNbAttachments
		sValue = トリム(CStr(range.Cells(lCurRow, 1).Value))
		もし (sValue <> "") そして ToImportExport(sValue) では
			もし (sValue <> sLastAttachmentType) では
				セット MyAttachmentType = dict.AttachmentTypes(sValue)
				' Check if AttachmentType exists
				もし MyAttachmentType そうなのか? 何もない では
					' Attachment type not found, we create it
					セット MyAttachmentType = dict.AttachmentTypes.Add(sValue, "Imported from file: " & EXCEL_FILE)
					' Filter types: ValidAttachmentBinding.ObjectType
					FilterTypes(MyAttachmentType, sValue)
				終了 もし
				sLastAttachmentType = sValue
			終了 もし

			値 トリム(CStr(range.Cells(lCurRow, 2).Value))
			もし (sValue <> "") では
				セット MyAttachment = MyAttachmentType.Attachments(sValue)
				' Check if Attachment exists
				もし MyAttachment そうなのか? 何もない では
					' Attachment not found, we create it
					セット MyAttachment = MyAttachmentType.Attachments.Add(sValue,  "Imported from file: " & EXCEL_FILE, "", TEXT_TYPE)
					Debug.プリント "Attachment created: " & MyAttachmentType.Name & " \ " & MyAttachment.Name
				その他
					デバッグ。.プリント "Attachment found: " & MyAttachmentType.Name & " \ " & MyAttachment.Name
				終了 もし

				lNbAttachmentsManaged += 1

				sDescription = トリム(CStr(range.Cells(lCurRow, 3).Value))

				もし sDescription <> "" では
				
					MyAttachment.Description = sDescription

				終了 もし

				iValue = CInt(トリム(range.Cells(lCurRow, 4).Value))

				MyAttachment.Datatype = iValue

				sValue = トリム(CStr(range.Cells(lCurRow, 6).Value))

				もし sValue <> "" では
				
					splitted = Split(sValue, ",")

					について Each sValue In splitted

						MyAttachment.TextList.Add(sValue)

					次のページ 値

				終了 もし

				sDefault = トリム(CStr(range.Cells(lCurRow, 5).Value))

				もし (sDefault <> "") では
					
					' Convert/Format the value to a string
					Select Case iValue

					Case NUMERIC_TYPE
						
						sDefault = CStr(CInt(sDefault))

					Case DATE_TYPE
						
						dt = CStr(CDate(sDefault))
						sDefault = フォーマット(dt, "MM/DD/YYYY")

					Case TIME_TYPE
						
						dt = CStr(CDate(sDefault)) ' Type checking through casting
						sDefault = フォーマット(dt, "hh:nn:ssAMPM") ' Expected ER/Studio format

					Case BOOLEAN_TYPE
						
						sDefault = CStr(CBool(sDefault))

					終了 Select

					MyAttachment.ValueDefault = sDefault

				終了 もし

			終了 もし

		終了 もし
	次のページ lCurRow

	ImportAttachments = lNbAttachmentsManaged
終了 機能

プライベート 機能 ImportSecurities(ByRef ex として Variant, ByRef dict として Dictionary) として 整数

	薄暗い シート として 対象
	薄暗い 範囲 として 対象

	薄暗い lNbSecurityProperties&

	薄暗い sValue$, iValue%, sDefault$
	薄暗い lNbSecuritiesManaged&

	薄暗い MySecurityType として SecurityType
	薄暗い MySecurityProperty として SecurityProperty

	薄暗い sLastSecurityType$

	薄暗い sDescription$, dt として Date, splitted$()

	セット sheet = ex.worksheets(XL_TAB_SECURITY)
	sheet.Activate
	セット range = sheet.usedrange
	range.Select
	sLastSecurityType = ""

	ImportSecurities = 0

	lNbSecurityProperties = range.Rows.Count
	Debug.プリント "Number of data security information: " & (lNbSecurityProperties - 1)
	lNbSecuritiesManaged = 0

	について lCurRow = 2 へ lNbSecurityProperties
		sValue = トリム(CStr(range.Cells(lCurRow, 1).Value))
		もし (sValue <> "") そして ToImportExport(sValue) では
			もし (sValue <> sLastSecurityType) では
				セット MySecurityType = dict.SecurityTypes(sValue)
				' Check if Security Type exists
				もし MySecurityType そうなのか? 何もない では
					' Security type not found, we create it
					セット MySecurityType = dict.SecurityTypes.Add(sValue, "Imported from file: " & EXCEL_FILE)
				終了 もし
				sLastSecurityType = sValue
			終了 もし

			値 トリム(CStr(range.Cells(lCurRow, 2).Value))
			もし (sValue <> "") では
				セット MySecurityProperty = MySecurityType.SecurityProperties(sValue)
				' Check if Security Property exists
				もし MySecurityProperty そうなのか? 何もない では
					' Security Property not found, we create it
					セット MySecurityProperty = MySecurityType.SecurityProperties.Add(sValue,  "Imported from file: " & EXCEL_FILE, "", TEXT_TYPE)
					Debug.プリント "Security Property created: " & MySecurityType.Name & " \ " & MySecurityProperty.Name
				その他
					デバッグ。.プリント "Security Property found: " & MySecurityType.Name & " \ " & MySecurityProperty.Name
				終了 もし

				lNbSecuritiesManaged += 1

				sDescription = トリム(CStr(range.Cells(lCurRow, 3).Value))

				もし sDescription <> "" では
				
					MySecurityProperty.Description = sDescription

				終了 もし

				iValue = CInt(トリム(range.Cells(lCurRow, 4).Value))

				MySecurityProperty.Datatype = iValue

				sValue = トリム(CStr(range.Cells(lCurRow, 6).Value))

				もし sValue <> "" では
				
					splitted = Split(sValue, ",")

					について Each sValue In splitted

						MySecurityProperty.TextList.Add(sValue)

					次のページ 値

				終了 もし

				sDefault = トリム(CStr(range.Cells(lCurRow, 5).Value))

				もし (sDefault <> "") では
					
					' Convert/Format the value to a string
					Select Case iValue

					Case NUMERIC_TYPE
						
						sDefault = CStr(CInt(sDefault))

					Case DATE_TYPE
						
						dt = CStr(CDate(sDefault))
						sDefault = フォーマット(dt, "MM/DD/YYYY")

					Case TIME_TYPE
						
						dt = CStr(CDate(sDefault)) ' Type checking through casting
						sDefault = フォーマット(dt, "hh:nn:ssAMPM") ' Expected ER/Studio format

					Case BOOLEAN_TYPE
						
						sDefault = CStr(CBool(sDefault))

					終了 Select

					MySecurityProperty.ValueDefault = sDefault

				終了 もし

			終了 もし

		終了 もし
	次のページ lCurRow

	ImportSecurities = lNbSecuritiesManaged
終了 機能

ERSBasicHandlers.bas

Some different examples using the Attachments created and utilized by the previous macros.

⚠️ You need to update the path to the macro in the following script (Line 20):

''MACRO TITLE: ERSBasicHandlers
' MACRO VERSION: 3.0
'This macro binds specific Attachments and Data Security Information
'	for Entities, Tables, Attributes, Columns, Relationships, Views,
'	Models & Submodels to specific ER Objects if the Enterprise
'	Data Dictionary is available
'
' Dependencies
'	wBindPropertiesToERObjects.bas
'
' Known limitations
'	There's no event for Business Data Objects
'
' Release notes
' 3.0:	Data Security Information added
' 2.0:	Relationships & Views added
'		Attachments supported across multiple ER Objects
' 1.0:	Initial version
'---------------------------------------------------------------------------
'#Uses "C:\ProgramData\Idera\ERStudioDA_20.1\Macros\w\Bound attachments V3\wBindPropertiesToERObjects.bas"

サブ CreateEntityHandler(CurEntity として 対象, CurDiagram として 対象)

	BindProperties(真)	'	Lazy method: the function is looping over all supported objects = not optimized

終了 サブ

' Bind Attributes & Columns
サブ CreateAttributeHandler(CurAttribute として 対象, CurDiagram として 対象)
	
	薄暗い MyDiagram として ダイアグラム
	薄暗い MyDictionary として Dictionary
	薄暗い MyModel として モデル
	薄暗い MyAttachmentType として AttachmentType
	薄暗い MyAttachment として Attachment
	薄暗い MySecurityType として SecurityType
	薄暗い MySecurityProperty として SecurityProperty
	薄暗い MyAttribute として AttributeObj

	もし CommonInit(CurDiagram, MyDiagram, MyDictionary) では
		
		セット MyAttribute = CurAttribute
	
		セット MyModel = MyDiagram.ActiveModel
	
		について Each MyAttachmentType In MyDictionary.AttachmentTypes
			
			もし IsMatching(MyAttachmentType.Name, IIf(MyModel.Logical, ATTRIBUTES, COLUMNS)) では
				
				について Each MyAttachment In MyAttachmentType.Attachments
	
					MyAttribute.BoundAttachments.Add(MyAttachment.ID)
	
				次のページ
	
			終了 もし
	
		次のページ MyAttachmentType
	
		について Each MySecurityType In MyDictionary.SecurityTypes
			
			もし IsMatching(MySecurityType.Name, IIf(MyModel.Logical, ATTRIBUTES, COLUMNS)) では
				
				について Each MySecurityProperty In MySecurityType.SecurityProperties
	
					MyAttribute.BoundSecurityProperties.Add(MySecurityProperty.ID)
	
				次のページ
	
			終了 もし
	
		次のページ MySecurityType

	終了 もし

終了 Sub


Sub CreateRelationshipHandler(CurRelationship として 対象, CurDiagram として 対象)
	
	' Relationships don't have Data Security Information

	薄暗い MyDiagram として ダイアグラム
	薄暗い MyDictionary として Dictionary
	薄暗い MyAttachmentType として AttachmentType
	薄暗い MyAttachment として Attachment
	薄暗い MyRelationship として 人間関係

	もし CommonInit(CurDiagram, MyDiagram, MyDictionary) では
		
		セット MyRelationship = CurRelationship

		について Each MyAttachmentType In MyDictionary.AttachmentTypes
			
			もし IsMatching(MyAttachmentType.Name, RELATIONSHIPS) では
				
				について Each MyAttachment In MyAttachmentType.Attachments
	
					MyRelationship.BoundAttachments.Add(MyAttachment.ID)
	
				次のページ
	
			終了 もし
	
		次のページ

	終了 もし

終了 Sub


Sub CreateIndexHandler(CurIndex として 対象, CurDiagram として 対象)

終了 Sub


Sub CreateModelHandler(CurModel として 対象, CurDiagram として 対象)
	
	薄暗い MyDiagram として ダイアグラム
	薄暗い MyDictionary として Dictionary
	薄暗い MyModel として モデル
	薄暗い MyAttachmentType として AttachmentType
	薄暗い MyAttachment として Attachment
	薄暗い MySecurityType として SecurityType
	薄暗い MySecurityProperty として SecurityProperty

	もし CommonInit(CurDiagram, MyDiagram, MyDictionary) では
		
		セット MyModel = CurModel

		について Each MyAttachmentType In MyDictionary.AttachmentTypes
			
			もし IsMatching(MyAttachmentType.Name, MODELS) では
				
				について Each MyAttachment In MyAttachmentType.Attachments
	
					MyModel.BoundAttachments.Add(MyAttachment.ID)
	
				次のページ
	
			終了 もし
	
		次のページ

		について Each MySecurityType In MyDictionary.SecurityTypes
			
			もし IsMatching(MySecurityType.Name, MODELS) では
				
				について Each MySecurityProperty In MySecurityType.SecurityProperties
	
					MyModel.BoundSecurityProperties.Add(MySecurityProperty.ID)
	
				次のページ
	
			終了 もし
	
		次のページ

	終了 もし

終了 Sub


Sub CreateSubModelHandler(CurSubModel として 対象, CurDiagram として 対象)
	
	薄暗い MyDiagram として ダイアグラム
	薄暗い MyDictionary として Dictionary
	薄暗い MySubmodel として SubModel
	薄暗い MyAttachmentType として AttachmentType
	薄暗い MyAttachment として Attachment
	薄暗い MySecurityType として SecurityType
	薄暗い MySecurityProperty として SecurityProperty

	もし CommonInit(CurDiagram, MyDiagram, MyDictionary) では
		
		セット MySubmodel = CurSubModel

		について Each MyAttachmentType In MyDictionary.AttachmentTypes
			
			もし IsMatching(MyAttachmentType.Name, SUBMODELS) では
				
				について Each MyAttachment In MyAttachmentType.Attachments
	
					MySubmodel.BoundAttachments.Add(MyAttachment.ID)
	
				次のページ
	
			終了 もし
	
		次のページ
	
		について Each MySecurityType In MyDictionary.SecurityTypes
			
			もし IsMatching(MySecurityType.Name, SUBMODELS) では
				
				について Each MySecurityProperty In MySecurityType.SecurityProperties
	
					MySubmodel.BoundSecurityProperties.Add(MySecurityProperty.ID)
	
				次のページ
	
			終了 もし
	
		次のページ

	終了 もし

終了 Sub


Sub CreateDomainHandler(CurDomain として 対象, CurDiagram として 対象)

終了 Sub


Sub CreateDefaultHandler(CurDefault として 対象, CurDiagram として 対象)

終了 Sub


Sub CreateUserDatatypeHandler(CurUserDatatype として 対象, CurDiagram として 対象)

終了 Sub


Sub CreateRuleHandler(CurRule として 対象, CurDiagram として 対象)

終了 Sub


Sub CreateViewHandler(CurView として 対象, CurDiagram として 対象)
	
	薄暗い MyDiagram として ダイアグラム
	薄暗い MyDictionary として Dictionary
	薄暗い MyAttachmentType として AttachmentType
	薄暗い MyAttachment として Attachment
	薄暗い MySecurityType として SecurityType
	薄暗い MySecurityProperty として SecurityProperty
	薄暗い MyView として 表示

	もし CommonInit(CurDiagram, MyDiagram, MyDictionary) では
		
		セット MyView = CurView

		について Each MyAttachmentType In MyDictionary.AttachmentTypes
			
			もし IsMatching(MyAttachmentType.Name, VIEWS) では
				
				について Each MyAttachment In MyAttachmentType.Attachments
	
					MyView.BoundAttachments.Add(MyAttachment.ID)
	
				次のページ
	
			終了 もし
	
		次のページ
	
		について Each MySecurityType In MyDictionary.SecurityTypes
			
			もし IsMatching(MySecurityType.Name, VIEWS) では
				
				について Each MySecurityProperty In MySecurityType.SecurityProperties
	
					MyView.BoundSecurityProperties.Add(MySecurityProperty.ID)
	
				次のページ
	
			終了 もし
	
		次のページ

	終了 もし

終了 Sub


Sub CreateTriggerHandler(CurTrigger として 対象, CurDiagram として 対象)

終了 Sub


Sub CreateProcedureHandler(CurProcedure として 対象, CurDiagram として 対象)

終了 Sub


Sub CreateViewRelationshipHandler(CurViewRelationship として 対象, CurDiagram として 対象)

終了 Sub

Sub CreateDiagramHandler(CurDiagram として 対象)
	
	' We don't load the attachments as they are already existing in the Enterprise Data Dictionary
'	' Load Attachments
'	MacroRun "C:\ProgramData\Idera\ERStudioDA_20.1\Macros\w\Bound attachments V3\wReadPropertiesFromExcel.bas"

終了 Sub

Sub CreateEntityDisplayHandler(CurEntityDisplay として 対象, CurDiagram として 対象)

終了 Sub

Sub CreateRelationshipDisplayHandler(CurRelationshipDisplay として 対象, CurDiagram として 対象)

終了 Sub

Sub CreateViewDisplayHandler(CurViewDisplay として 対象, CurDiagram として 対象)

終了 Sub

Sub CreateViewRelationshipDisplayHandler(CurViewRelationshipDisplay として 対象, CurDiagram として 対象)

終了 Sub

Sub CreateViewFieldHandler(CurViewField として 対象, CurDiagram として 対象)

終了 Sub

Sub CreateFKColumnPairHandler(CurFKColumnPair として 対象, CurDiagram として 対象)

終了 Sub

Sub CreateIndexColumnHandler(CurIndexColumn として 対象, CurDiagram として 対象)

終了 Sub

Sub CreateSubTypeHandler(CurSubType として 対象, CurDiagram として 対象)

終了 Sub

Sub CreateSubTypeClusterHandler(CurSubTypeCluster として 対象, CurDiagram として 対象)

終了 サブ

プライベート 機能 CommonInit(ByRef CurDiagram として 対象, ByRef MyDiagram として Diagram, ByRef MyDictionary として Dictionary) として ブーリアン
	
	セット MyDiagram = CurDiagram

	もし DICTIONARY_NAME = "" では
		セット MyDictionary = MyDiagram.Dictionary
	その他
		セット MyDictionary = MyDiagram.EnterpriseDataDictionaries.Item(DICTIONARY_NAME)
	終了 もし

	CommonInit = Not (MyDiagram そうなのか? 何もない あるいは MyDictionary そうなのか? 何もない)

終了 機能

概要

It now supports エンティティ, Tables, 属性, Columns, 人間関係, ビュー, Models, Submodels & ビジネス データオブジェクト, but it can be easily extended to also support other objects (Shapes, etc.).

In the two previous posts, we used a ローカルデータディクショナリ.

で the above scripts, we have utilized an エンタープライズデータディクショナリ containing all our Attachments そして Data Security Information.
This エンタープライズデータディクショナリ is bound to all projects to ensure consistency in properties across all diagrams.

Enterprise Data Dictionaries
Enterprise Data Dictionaries bound to the project

Then, if we publish our project in Team Server Core, everyone can directly access the models and the values of the Attachments & Data Security Information.

Model shared with Team Server Core
Model shared with Team Server Core
Team Server Core
Properties available through Team Server Core

Moreover, from the Attachments and Data Security Information properties, we can see where they are bound and the values used by each object:

Attachment bindings through Team Server Core
Attachment bindings through Team Server Core
Data Security Information bindings through Team Server Core
Data Security Information bindings through Team Server Core

Finally, this post should conclude this trilogy where we have seen the 5 scripts evolve through successive updates.

As usual, feel free to modify the scripts to meet your expectations perfectly, or simply copy parts of these scripts into your own macros.

著作権 © 2026 Idera, Inc.
Hi! Need help finding something?
ER/Studio
Here to help you find your way