Search notes:

Office VBA: set Azure Information Protection Label

This simple example tries to demonstrate how a Azure Information Proection label can be assigned to an Excel document (workbook) with Visual Basic for Applications.
option explicit

sub mai() ' {

    dim wb as workbook
    set wb = workbooks.add

    dim guid_internal_use_only as string
        guid_internal_use_only = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

    wb.customDocumentProperties.add "MSIP_Label_" & guid_internal_use_only & "_Enabled", false, msoPropertyTypeString, "true"

    wb.saveAs environ("temp") & "\created-at-" & format(now(), "yyyy-mm-dd_hh-nn")

    debug.print wb.name

end sub ' }
Github repository about-MS-Office-object-model, path: /Office/DocumentProperties/set-Azure-Information-Protection-Label.vb

Index