Example:
In the following example a message is output identifying the object to be deleted:
Private Sub Document_BeforeHMIObjectDelete(ByVal HMIObject As IHMIObject, Cancel As
Boolean, CancelForwarding As Boolean)
'VBA80
Dim strObjName As String
Dim strAnswer As String
'
'"strObjName" contains the name of the deleted object
strObjName = HMIObject.ObjectName
strAnswer = MsgBox("Are you sure to delete " & strObjName & "?", vbYesNo)
If strAnswer = vbNo Then
'if pressed "No" -> set Cancel to true for prevent delete
Cancel = True
End If
End Sub
See also
VBA Reference (Page 1664)
BeforeLibraryFolderDelete event
Description
Occurs immediately before a folder in the components library is deleted.
syntax
Note
To ensure that the application-specific event is available in the project, the application must
be made known to Graphics Designer. This is done by means of the following statement:
Dim WithEvents <Name> As grafexe.Application
In the following example, the name "objGDApplication" is substituted for <Name>.
objGDApplication_BeforeLibraryFolderDelete(LibObject As
HMIFolderItem, Cancel As Boolean)
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
1676
System Manual, 11/2008,