5. In order to copy an object from the active picture to the "Project Library", insert a procedure
like "AddObjectFromPictureToProjectLibrary()" into document. In this example, the object
"Circle1" is created in the active picture and then copied to the folder "Folder1":
Sub AddObjectFromPictureToProjectLibrary()
'VBA22
Dim objProjectLib As HMISymbolLibrary
Dim objCircle As HMICircle
Set objProjectLib = Application.SymbolLibraries(2)
'
'Insert new object "Circle1"
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle1",
"HMICircle")
'
'The folder "Custom Folder" has to be available
'("AddItem(DefaultName, pHMIObject)"-Methode):
objProjectLib.FolderItems("Folder1").Folder.AddItem "ProjectLib
Circle", ActiveDocument.HMIObjects("Circle1")
End Sub
6. To delete an object from the component library, insert a "DeleteObjectFromProjectLibrary()"
procedure in the document, for example. In this example the previously created folder
"Folder1" is deleted:
Sub DeleteObjectFromProjectLibrary()
'VBA23
Dim objProjectLib As HMISymbolLibrary
Set objProjectLib = Application.SymbolLibraries(2)
'
'The folder "Custom Folder" has to be available
"Delete" Method:
objProjectLib.FolderItems("Folder1").Delete
End Sub
7. Start the procedure with <F5>.
See also
SymbolLibrary Object (Page 1962)
SymbolLibraries Object (Listing) (Page 1963)
PasteClipboard Method (Page 1781)
Delete Method (Page 1745)
CopyToClipboard Method (Page 1740)
AddItem Method (Page 1720)
AddFromClipboard Method (Page 1717)
AddFolder Method (Page 1716)
How to Insert an Object from the Component Library into a Picture with VBA (Page 1599)
Accessing the component library with VBA (Page 1593)
VBA for Automated Configuration
4.3 VBA in the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
1598
System Manual, 11/2008,