Forum Discussion
Table cell value from VBA
Hello, I have a question.
When I get the value of a cell from a table in Word, it always brings it with an unknown character.
If we activate "Show All" we see that there is a respective symbol for each cell, although each part of a document has its own symbol, like space, section break, page break, paragraph, etc. In fact, I get, for the example of this post, the value of a paragraph and it gives it to me clean, without any character.
So, I don't understand what is that character that brings the value of the cell, do you know what is that character and do you know what other way there is to extract the value cleaner without that character?
I show you in the screenshot the solution I gave to this problem (it is as a comment), but I would like to know if you have another way to solve this issue.
LuisElCaminante Use the following construction
Dim t As Table Dim r As Range Set t = ActiveDocument.Tables(1) Set r = t.Cell(1, 2).Range r.End = r.End - 1 Debug.Print r.Text
LuisElCaminante Use the following construction
Dim t As Table Dim r As Range Set t = ActiveDocument.Tables(1) Set r = t.Cell(1, 2).Range r.End = r.End - 1 Debug.Print r.Text
- LuisElCaminanteBrass ContributorThank you very much!
Your solution is much better than mine and more efficient.
Thank you!