Any one know how to use AddIn field like EndNote does?

MeThee Loquat 1 Reputation point
2022-03-03T13:53:27.173+00:00

what EndNote has done?
it add a field code like this:
{ADDIN EN.CITE <EndNote><Cite><RecNum>0</RecNum><Note>MyAddInField</Note><DisplayText>MyAddInField</DisplayText></Cite></EndNote>}
and the result is:
MyAddInField

i found there are none document of how to use it, but why EndNote can...

Word Management
Word Management
Word: A family of Microsoft word processing software products for creating web, email, and print documents.Management: The act or process of organizing, handling, directing or controlling something.
900 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Ceasar Chen_MSFT 4,391 Reputation points
    2022-03-04T09:08:23.227+00:00

    Hi, @MeThee Loquat
    Welcome to the Q&A community, I want to help you but EndNote is a third-party software, and I am responsible for Office general issues.
    What is the code you provided trying to achieve?
    I can't find the description of Addin fields by searching the related technical documents of Word(list-of-field-codes-in-word1), but there is wdFieldAddin in the VBA reference of this link: word.wdfieldtype
    For VBA problems, you can refer to the content under the office-vba-dev tag.
    Thanks for your understanding.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Charles Kenyon 2,581 Reputation points
    2022-03-05T03:53:49.877+00:00

    Following the MVP information here is some sample vba code. This code assumes that there is an ADDIN field.

    Sub AddInFieldRead()
        ' Charles Kenyon
        Debug.Print ActiveDocument.Fields(1).Data ' gets data from Add-In field if that is the first field
        Dim oField As Field
        For Each oField In ActiveDocument.Fields
            If oField.Type = wdFieldAddin Then Debug.Print oField.Data ' will reveal data from any AddIn field in Immediate Window
            If oField.Type = wdFieldAddin Then MsgBox oField.Data  ' will reveal data from any AddIn field in Message Box
        Next oField
    End Sub
    

  3. Peter Jamieson 116 Reputation points
    2022-03-30T18:58:05.623+00:00

    Endnote uses a facility that was originally introduced in the early days of Word for Windows several decades ago to support the kinds of addin that existed at that time - I cannot remember specific names, but one class of addin were things such as Borland SideKick and Packrat that were known as "PIMs" (Personal Information Managers). They needed to save bits of information that could not easily be seen or modifed by the user.

    The two fields used to do that were ADDIN and PRIVATE. I don't think either field is mentioned in the ISO29500 specifications for .docx. I think they both allowed you to store data using the field.data member, but also AFAICR using the .data member has been deprecated for some field types - if you use it and save a document, you may find that Word will not open it again. ADDIN fields are isible unless you or our code formats them as hidden. PRIVATE fields are hidden by default, like some other fields such as XE and TC fields.

    other than that, EndNote and other Addins will use the .Code member of the field how they want (i.e. the text of the field, e.g. "ADDIN EN.CITE etc.", which will be visible if the user and the .Data member, which wouldn't be visible unless you looked at the underlying XML code for the Word document.) So stuff like EN.CITE is just text that EndNote inserts - EndNote does not have to register an "EN.CITE" code with Word or anything like that. All it has to do is ensure that the text that it adds to the field code does not result in any problems in Word and "round-trips@ successfully when Word - perhaps a different version or on a different platform - saves and opens the document.

    ADDIN and PRIVATE fields aren't the only fields where you can add a lot of text - e.g. you can use

    { SET comment loads of text }

    (I sometimes use it to document field coding).

    0 comments No comments

  4. MeThee Loquat 1 Reputation point
    2023-09-07T09:43:44.0833333+00:00

    i has been long time, sorry for not keep following up

    i wanna add new fields to word

    such as Left Right Mid InStr, for string processing

    and SectionPages(i), add parameter to some fields.

    0 comments No comments