Attatching an XML Expansion Pack to a document programmatically

Avner writes about how to attach a smart document XML Expansion Pack to a document programmatically:

Sub AttachManifest()

    Dim Namespace As XMLNamespace
Set Namespace = ActiveDocument.Application.XMLNamespaces.Add(“C:\Projects\SD\my.xsd, “My Schema“, “my“, True)
Namespace.AttachToDocument (ActiveDocument)
ActiveDocument.Application.XMLNamespaces.InstallManifest "C:\Projects\SD\manifest_signed.xml", True

ActiveDocument.SmartDocument.SolutionURL = "C:\Projects\SD\manifest_signed.xml"
ActiveDocument.SmartDocument.SolutionID = "My Schema"

End Sub

[This is VBA by the way]