none
Can we know the upper limit of bookmarks and Variables using word API? RRS feed

  • Question

  • I am looking for the numbers of bookmarks and Variables that a .docx or .doc document can have, I mean the upper limit in Microsoft Word, using the Word API.
    Wednesday, February 15, 2017 11:08 AM

Answers

  • Hi Neha (Ictect),

    No, there is no way to get upper limit of Bookmarks and variables by any program or api.

    we can create Bookmarks and variables programmatically but we can't fetch it's limit.

    as I inform you in my previous reply, the limits can be different with different version of MS Word.

    are you going to create that much Bookmarks and variables that can cross the maximum limit ?

    what's your actual requirement?

    because in general cases , I didn't see anyone who have requirement to create this much large number of Bookmarks and variables.

    and suppose you create and reach the maximum limit then you also need to think about the performance of that document, how will you manage all these Bookmarks and variables.

    what happen if I try to open that document with older version of MS Word.

    so better you tell us your goal, so that we can try to suggest you in that direction.

    Regards

    Deepak


    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 MSDNFSF@microsoft.com.

    • Marked as answer by Neha (Ictect) Monday, February 20, 2017 5:56 AM
    Friday, February 17, 2017 5:55 AM
    Moderator

All replies

  • Hi Neha (Ictect),

    First of all I want to inform you that limit decide by the MS Office Word Application not by the word api.

    the limit can be differ with different versions of MS Word Application.

    As per the documentation below which is applied for Word 2000 to Word 2016.

    you can create maximum 2,147,483,647 bookmarks (applied for word 2007 and later versions)

    in compatibility mode you can create maximum 16,380 bookmarks.

    Operating parameter limitations and specifications in Word

    I try to find the maximum number of word variable limitation but I did not able to find any documentation that can tell us the limit.

    but in some cases I had find that user's notice that they can create 32767 word variables maximum. so it's looks like this is the limit. because they had mentioned that if they try to create more variable then this then they get exceptions.

    but still it is unverified because there is no any Microsoft documentation available currently that can describe and confirm this limit.

    Regards

    Deepak


    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 MSDNFSF@microsoft.com.

    Thursday, February 16, 2017 1:11 AM
    Moderator
  • Thanks Deepak, it is helpful.

    Not with word API, any other way to get the upper limit of bookmark and variables from any program or API rather then setting the values static in code.

    Regards,

    Neha

    Thursday, February 16, 2017 10:11 AM
  • Hi Neha (Ictect),

    No, there is no way to get upper limit of Bookmarks and variables by any program or api.

    we can create Bookmarks and variables programmatically but we can't fetch it's limit.

    as I inform you in my previous reply, the limits can be different with different version of MS Word.

    are you going to create that much Bookmarks and variables that can cross the maximum limit ?

    what's your actual requirement?

    because in general cases , I didn't see anyone who have requirement to create this much large number of Bookmarks and variables.

    and suppose you create and reach the maximum limit then you also need to think about the performance of that document, how will you manage all these Bookmarks and variables.

    what happen if I try to open that document with older version of MS Word.

    so better you tell us your goal, so that we can try to suggest you in that direction.

    Regards

    Deepak


    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 MSDNFSF@microsoft.com.

    • Marked as answer by Neha (Ictect) Monday, February 20, 2017 5:56 AM
    Friday, February 17, 2017 5:55 AM
    Moderator
  • Thanks for confirming on the API, I got my answer.

    We have an addin to Microsoft word, that process word document content and apply bookmarks and variables, to make it manageable.

    We got to know that client is using 1600+ pages documents, so to let them know about the maximum limit about the variables I was looking for something from the API but that's ok, I can hard code the value from the blog you mentioned based on different word versions.

    Thanks again.

    Neha

    Monday, February 20, 2017 6:01 AM