locked
Problem in replacing the text of bookmarks RRS feed

  • Question

  • Hi,

    I have developed a component that reads sentences of a word file one by one and then bookmarks each read sentence using a new name. Then it gives each sentence to a translator engine and receives its translation and saves it in a data structure. At the end, it uses these previously saved translations to replace each bookmark with the related translation. During the last process, there occurs some problem. After I replace the text of a bookmark and go to the next bookmark, the text of this next bookmark would include part of the new text replaced in the previous bookmark. So if I replace the text of this next bookmark with the translation I would lose some part of the text replaced in the previous bookmark. How can I solve this problem?

    Regards,

    Hamidreza Ghader   

    Monday, January 17, 2011 7:24 AM

Answers

  • See the article "Working with Bookmarks in VBA” at:

    http://www.word.mvps.org/FAQs/MacrosVBA/WorkWithBookmarks.htm
     -- Hope this helps.

    Doug Robbins - Word MVP,
    dkr[atsymbol]mvps[dot]org
    Posted via the Community Bridge

    "Hamidreza G" wrote in message news:f9040bed-fa82-4f8c-86d9-cc22a7fbad80@communitybridge.codeplex.com...

    Hi,

    I have developed a component that reads sentences of a word file one by one and then bookmarks each read sentence using a new name. Then it gives each sentence to a translator engine and receives its translation and saves it in a data structure. At the end, it uses these previously saved translations to replace each bookmark with the related translation. During the last process, there occurs some problem. After I replace the text of a bookmark and go to the next bookmark, the text of this next bookmark would include part of the new text replaced in the previous bookmark. So if I replace the text of this next bookmark with the translation I would lose some part of the text replaced in the previous bookmark. How can I solve this problem?

    Regards,

    Hamidreza Ghader


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
    • Marked as answer by Hamidreza G Tuesday, January 18, 2011 5:49 AM
    Monday, January 17, 2011 8:08 AM

All replies

  • See the article "Working with Bookmarks in VBA” at:

    http://www.word.mvps.org/FAQs/MacrosVBA/WorkWithBookmarks.htm
     -- Hope this helps.

    Doug Robbins - Word MVP,
    dkr[atsymbol]mvps[dot]org
    Posted via the Community Bridge

    "Hamidreza G" wrote in message news:f9040bed-fa82-4f8c-86d9-cc22a7fbad80@communitybridge.codeplex.com...

    Hi,

    I have developed a component that reads sentences of a word file one by one and then bookmarks each read sentence using a new name. Then it gives each sentence to a translator engine and receives its translation and saves it in a data structure. At the end, it uses these previously saved translations to replace each bookmark with the related translation. During the last process, there occurs some problem. After I replace the text of a bookmark and go to the next bookmark, the text of this next bookmark would include part of the new text replaced in the previous bookmark. So if I replace the text of this next bookmark with the translation I would lose some part of the text replaced in the previous bookmark. How can I solve this problem?

    Regards,

    Hamidreza Ghader


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
    • Marked as answer by Hamidreza G Tuesday, January 18, 2011 5:49 AM
    Monday, January 17, 2011 8:08 AM
  • Hi Hamidreza

    If the article Doug points you at doesn't help, please post the code you use to assign, retrieve and replace bookmark content.


    Cindy Meister, VSTO/Word MVP
    Monday, January 17, 2011 9:42 AM