Add Logs Button in Word 2016 RRS feed

  • Question

  • I'm wanting to create a logging document in MS Word 2016.  I've added all the static fields that I want in the document.  But I want to add a "Log Entry" button that creates a new (preferably dated) text box that users cannot go back and edit.


    1) Click button

    2) Date is generated (perhaps time also)

    3) Text field created.

    4) User types in the field, clicks a control (button, or maybe another form field)

    5) Text box field cannot be reentered.

    I think this is relatively simple VBA.  But I'm unsure where to turn for help with the code.  I'm a terrible "white sheet" programmer, better at editing existing code to suit my needs.

    FYI, I think the newer text field has a property to "remove content control when contents are edited.  I think that's my method to "lock" the field.

    Friday, June 9, 2017 4:49 PM


All replies

  • Hi Rob,

    Thanks for visiting our forum.

    Then here we mainly focus on general questions about Word client. As your query is related to VBA code, we'll move your thread to the following dedicated MSDN forum for Word:

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Best regards,
    Yuki Sun

    Please remember to mark the replies as answers if they helped.

    If you have feedback for TechNet Subscriber Support, contact

    Monday, June 12, 2017 9:08 AM
  • Hello,

    You could get started from recording macros to check the API. Please visit Create or run a macro.

    To create a content control, you could use ContentControls.Add Method (Word).

    To set the property "remove content control when contents are edited", you could use ContentControl.Temporary Property (Word)



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    • Marked as answer by Rob J Vargas Tuesday, December 12, 2017 6:12 PM
    Tuesday, June 13, 2017 2:31 AM