示例:创建文件夹并添加标签

本示例用于在标签数据库中创建文件夹,并向新文件夹添加标签。
Sub CreateTagDBFolder() On Error GoTo Err_Handler Dim oNewTag As Tag 'Create a folder and subfolder. TagDB.CreateFolder "Machine1\Motor1" 'Add a tag to the folder. Set oNewTag = TagDB.CreateTag("Machine1\Motor1\Speed", AnalogTag) 'Configure tag properties. oNewTag.Description = "My New Tag" 'Save the tag configuration. oNewTag.WriteConfiguration 'Release resources associated with the tag object. Set oNewTag = Nothing Exit Sub Err_Handler: 'Release resources associated with the tag object. Set oNewTag = Nothing MsgBox "Error creating folder or tag." & vbCrLf & vbCrLf & _ Err.Description, vbExclamation, "CreateFolder" End Sub
提供反馈
对本文档有问题或反馈吗? 请在这里提交您的反馈
Normal