Security Function
The security function for a macro feature is optional for a VBA-based
macro feature, but required for a COM-based macro feature. This function:
Obtains the IMacroFeatureData
object from the input Feature object
Obtains parameters from the IMacroFeatureData
object
-
Processes the inputs according to the security preferences of the
feature:
- All work should be designed with the return value in mind.
- The inputs will be useful for determining the return value.
Returns values that are a combination of the values
in swMacroFeatureSecurityOptions_e
This following example illustrates a VBA-based security function.
Public Function swmSecurity(app As Variant,
part As Variant, feature As Variant) As Variant
' If the file security.txt exists, then
enable displaying a note
' for the macro feature
' See IFeatureManager::InsertSecurityNote
for more information about
' notes and macro features
Dim
nSecurityOptions As swMacroFeatureSecurityOptions_e
nSecurityOptions
= swMacroFeatureSecurityByDefault
Dim
fso As FileSystemObject
If
(fso Is Nothing) Then
Set
fso = New Scripting.FileSystemObject
End
If
If
(Not (fso Is Nothing)) Then
If
(fso.FileExists("C:\Test\MacroFeatureSamples\security.txt"))
Then
nSecurityOptions
= nSecurityOptions Or swMacroFeatureSecurityEnableNote
End
If
End
If
swmSecurity
= nSecurityOptions
End Function