Hi @JOHNATHAN RODRIGO SERRANO GARCIA ,
Thanks for reaching out.
I understand while saving the excel files, Azure Information Protection asking to label the files and you are looking to assign the label using VBA.
There is the document provided by Microsoft to label the office document using LabelInfo object. In the similar way you can assign the label to Excel workbook to save multiple files in different location.
Dim myLabelInfo, context
Set myLabelInfo = objWorkbook.SensitivityLabel.CreateLabelInfo()
Set context = CreateObject("Scripting.Dictionary")
With myLabelInfo
.AssignmentMethod = 1
.IsEnabled = True
.LabelId = "--your labelID--"
.LabelName = "--your label name--"
.SetDate = Now()
End With
objWorkbook.SensitivityLabel.SetLabel myLabelInfo, context
where Label id and LabelName need to replace with your actual label id and name.
and SensitivityLabel.SetLabel requires a context object which can be anything if you are not using it.
You can get the Label details using Get-AIPFileStatus "C:\myFile.xlsx"
Hope this will help.
Thanks,
Shweta
-------------------------------
Please remember to "Accept Answer" if answer helped you.