VBCommons/api/ex_Metadata.bas

41 lines
1.0 KiB
QBasic
Raw Permalink Normal View History

2024-06-07 20:46:40 +03:00
Attribute VB_Name = "ex_Metadata"
'================ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> =============
' Shared module version: 20210506
' Depends on:
' Required reference: Scripting
Option Private Module
Option Explicit
Public Function MetadataExists(iDoc As Object, varName$) As Boolean
Dim aVar As Variant
For Each aVar In iDoc.Variables
If aVar.Name = varName Then
MetadataExists = True
Exit Function
End If
Next aVar
MetadataExists = False
End Function
Public Function GetMetadata(iDoc As Object, varName$) As Variant
Dim aVar As Variant
For Each aVar In iDoc.Variables
If aVar.Name = varName Then
GetMetadata = aVar.Value
Exit Function
End If
Next aVar
GetMetadata = ""
End Function
Public Function SetMetadata(iDoc As Object, varName$, val As Variant)
Dim aVar As Variant
For Each aVar In iDoc.Variables
If aVar.Name = varName Then
aVar.Value = val
Exit Function
End If
Next aVar
Call iDoc.Variables.Add(varName, val)
End Function