'I use this to invoke the functions and save the document. This seems to work for me and persists beyond save/close of the document. Your previous functions were always returning True for some reason. I have also modified both of your functions so that they return a value to the calling procedure and therefore can be used in boolean statements to evaluate whether the properties were assigned without error. It's almost always better to trap that error, and you can do that with a function that checks whether a property exists, rather than trying to assign to a non-existent property and handle the err.Number. I don't see anything obvious but I don't like your On Error Resume Next. ![]() ' Set the required properties for this documentįunction SetProperties(ByVal DocumentName As String, _Ĭall UpdateCustomDocumentProperty(tempDoc, "Title", DocumentName & ".pdf", 4)Ĭall UpdateCustomDocumentProperty(tempDoc, "Subject", "New Starter Guides", 4)Ĭall UpdateCustomDocumentProperty(tempDoc, "Keywords", "new starters, guide, help", 4)įunction UpdateCustomDocumentProperty(ByRef doc As Document, _īyVal propertyType As Office.MsoDocProperties)ĭoc.CustomDocumentProperties(propertyName).value = propertyValue I'm trying to change the properties of a document before I save it, but none of my properties below are being added.
0 Comments
Leave a Reply. |