none
VBA in Word Table showing mystery character RRS feed

  • Question

  • Hi,

    I have created a Dim called Name, which links to a cell in a table, when I press F8 to go through the code bit by bit, and hover over the dim it displays the content of that Dim, but also displays some sort of mystery character, it looks like a bullet point. But when I look in my actual table it isnt there. Please could you tell me what this character is, and how to get rid of it.

    Thanks

    Ben

    Wednesday, November 6, 2013 4:17 PM

Answers

  • It is the end-of-cell marker. If you show non-printing characters in Word (press Ctrl+Shift+8 to toggle non-printing characters), you will see the end-of-cell markers in the document.

    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Wednesday, November 6, 2013 5:18 PM
  • Hi Ben

    Expanding on Hans's answer:

    The end-of-cell marker is character code ANSI 7. In most versions of Word, returning the text of a cell will also return ANSI 13 (carriage return; a Word paragraph mark) that's closely linked to the end-of-cell marker and isn't visible as a separate character in the cell when non-printing characters are displayed.

    In order to remove these from the text string you need to cut off the last one (or two, depending on the version of Word) characters in the string. Something like:

    myString = Mid(myString, 1, Len(myString) - 1) 'or - 2


    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, November 6, 2013 5:29 PM
    Moderator

All replies

  • It is the end-of-cell marker. If you show non-printing characters in Word (press Ctrl+Shift+8 to toggle non-printing characters), you will see the end-of-cell markers in the document.

    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Wednesday, November 6, 2013 5:18 PM
  • Hi Ben

    Expanding on Hans's answer:

    The end-of-cell marker is character code ANSI 7. In most versions of Word, returning the text of a cell will also return ANSI 13 (carriage return; a Word paragraph mark) that's closely linked to the end-of-cell marker and isn't visible as a separate character in the cell when non-printing characters are displayed.

    In order to remove these from the text string you need to cut off the last one (or two, depending on the version of Word) characters in the string. Something like:

    myString = Mid(myString, 1, Len(myString) - 1) 'or - 2


    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, November 6, 2013 5:29 PM
    Moderator