Share via

Force Word bookmark to interpret number as text

Anonymous
2021-08-18T14:23:26+00:00

Dear,

As in excel with the apostrophe. I'm looking for a way to force word to interpret numbers in a bookmark as Text instead of numbers.

As part of the integration between Office and another application, I have to use bookmarks.

When I have 04 in my word bookmark, Word interpet it as number. So, when I send the bookmark value to the other application the result is: 4.000000 instead of the 04 waited.

When the value is sent by excel, with 04 as text ('04), the integration works as it should do.

Thank you for your help

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

12 answers

Sort by: Most helpful
  1. Doug Robbins - MVP - Office Apps and Services 323.1K Reputation points MVP Volunteer Moderator
    2021-08-18T23:47:03+00:00

    Using

    MsgBox Format(ActiveDocument.Bookmarks("Test").Range.Text, "00")

    results in the following being displayed

    Was this answer helpful?

    2 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2021-08-19T20:39:25+00:00

    I looked at it. Take a look at this revision:

    https://www.dropbox.com/s/t66gjnuqqci8ect/delet...

    First, you do have both Content Controls and formfields in your document. Change the formfields to Content Controls. That is not the source of your problem.

    I am unsure of the source of your problem. I first tried a repurposed Company Document Property Content Control and got the same results you were.

    Then I used one of Greg Maxey's tools to insert a Mapped Plain Text Content Control and copied that to the appropriate places. With that, I had did not have the problem you were seeing. The changes persisted in the saved document. Here is a link to that tool:

    https://gregmaxey.com/word_tip_pages/Content_Co...


    This link is to a page that I use and trust. It is safe. I am providing it because I think it contains information that will help you. However, as an Independent Advisor I am required to add the following when posting here with a link to any non-Microsoft site, even my own site:


    Required Notice: This is a non-Microsoft website. The page appears to be providing accurate, safe information. Watch out for ads on the site that may advertise products frequently classified as a PUP (Potentially Unwanted Products). Thoroughly research any product advertised on the site before you decide to download and install it.


    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  3. Anonymous
    2021-08-18T17:28:24+00:00

    There is nothing native to Word's interface to handle this. I think you are going to have to deal with it in your application by defining what is recovered as a string rather than a number.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  4. Anonymous
    2021-08-18T17:20:53+00:00

    HI Charles,

    Thank you for your reply.

    That's the content in the bookmarks that's numer.

    The bookmarks' names are with letters.

    Our PLM (the other application) get the datas from a mapping between it and Word bookmarks.

    ID number is a bookmark

    Revision another

    ....

    Regards

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2021-08-18T16:51:34+00:00

    Hello Nico,

    This forum is a user-to-user support forum. I am a fellow user with decades of experience using Microsoft Word. I have written extensively on using Word and have help articles on the Microsoft site.

    Bookmarks in Word cannot start with a number in the name. Is the bookmark named '04' or does it contain '04'?

    How is the other application getting this from Word? Are you using Mail Merge?

    I hope this information helps.

    I like to also provide this link about Ransomware even though it has nothing to do with your question:

    https://answers.microsoft.com/en-us/protect/for...

    Please let me know if you have any more questions or require further help.

    You can ask for more help by replying to this post (Reply button below).

    Stay well

    Was this answer helpful?

    0 comments No comments