$property = "FooBar"; $doc->CustomDocumentProperties($property)->{Value} = $text_value; #### 'If customdocument property did not exist, create it If Err.Number <> 0 Then Set DocProps = ThisWorkbook.CustomDocumentProperties DocProps.Add Name:="FooBar", _ LinkToContent:=False, _ Type:=msoPropertyTypeString, _ Value:=str_content End If