0

I'm working on the script below to add a Microsoft Azure Information Protection Label and not able to add MSIP label.

loc= "C:\Users\user88\Downloads\file.xlsx"
guid = "abc-0-123" 

With objExcel
    .Workbooks.Open(loc)
    .Workbooks.CustomDocumentProperties.Add "MSIP_Label_" & guid & "_Enabled", False, msoPropertyTypeString, "true"
    .ActiveWorkbook.SaveAs(loc), 51
    .Activeworkbook.Close
End With

Error message I get on the MSIP_Label_ line: Object doesn't support this property or method: Workbook.CustomDocumentProperties.

What do I need to change?

user3168017
  • 39
  • 1
  • 6
  • The [property](https://docs.microsoft.com/en-us/office/vba/api/excel.workbook.customdocumentproperties) is on the `WorkBook` object, not the `WorkBooks` collection. – user692942 Nov 18 '21 at 23:59

0 Answers0