View Single Post
 
Old 03-09-2021, 10:49 PM
NicoleJones NicoleJones is offline Windows 10 Office 2016
Novice
 
Join Date: Jan 2020
Posts: 11
NicoleJones is on a distinguished road
Default Adding Custom Document Properties

Hi

I am trying to add new document properties a new document is created off of a template, however I get run-time error "Invalid procedure call or argument". Just wondering if anyone knows where I am going wrong

Code:
Dim APS_ContractNumber As Boolean
Dim APS_DocumentCode As Boolean
Dim APS_DocumentNumber As Boolean
Dim APS_DocumentTitle As Boolean
Dim APS_DocumentType As Boolean
Dim APS_Revision As Boolean
Dim APS_RevisionDate As Boolean
Dim APS_SubjectCode As Boolean
Dim APS_UniqueIdentifier As Boolean


Private Sub Document_New()
    With ActiveDocument.CustomDocumentProperties
        .Add Name:="APS_ContractNumber", _
            LinkToContent:=True, _
            Type:=msoPropertyTypeString, _
            Value:="[Contract Number]"
        .Add Name:="APS_DocumentCode", _
            LinkToContent:=False, _
            Type:=msoPropertyTypeNumber, _
            Value:="[Document Code]"
        .Add Name:="APS_DocumentNumber", _
            LinkToContent:=False, _
            Type:=msoPropertyTypeString, _
            Value:="[Document Number]"
        .Add Name:="APS_DocumentTitle", _
            LinkToContent:=False, _
            Type:=msoPropertyTypeString, _
            Value:="[Document Title]"
        .Add Name:="APS_DocumentType", _
            LinkToContent:=False, _
            Type:=msoPropertyTypeString, _
            Value:="[DDD]"
        .Add Name:="APS_Revision", _
            LinkToContent:=False, _
            Type:=msoPropertyTypeString, _
            Value:="[RR]"
         .Add Name:="APS_RevisionDate", _
            LinkToContent:=False, _
            Type:=msoPropertyTypeDate, _
            Value:="[01/01/2000]"
        .Add Name:="APS_SubjectCode", _
            LinkToContent:=False, _
            Type:=msoPropertyTypeString, _
            Value:="[Subject Code]"
         .Add Name:="APS_UniqueIdentifier", _
            LinkToContent:=False, _
            Type:=msoPropertyTypeString, _
            Value:="[XXX]"
    End With

End Sub
Reply With Quote