Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieve the document's content text in plain text format. (MS WORD)

Status
Not open for further replies.

Grayfox081877

Programmer
Jan 21, 2002
9
0
0
PH
Hi Guys...

I need to find out how to retrieve the tables contents text in plain text format.

If I use ActiveDocument.Tables(1).Cell(1,2).Range.Text
it gives me wierd little boxes ..like this

"Test Data"


Please help

Thanks
GrayFox

 
I Guess ... I'm not the only one who encountered this problem..

Here's my solution.

this will remove all those weird boxes..

Private Function ClearString(strWord As String) As String
Dim xstr As String
xstr = Replace(Trim(strWord), Chr(7), "", , , 0)
ClearString = Replace(Trim(xstr), Chr(13), "", , , 0)
End Function


thanks again
 
Hi Grayfox081877,

I'm sure you're not the only one [smile]

When you say plain text, what exactly do you want instead of the various characters (tabs, paragraph marks, cell marks, etc). If you just want to lose the little square (the end of cell marker) at the end then you could use ..

strWord = left(strWord,len(strWord)-1)

.. or various other constructs including your own ..

Code:
Replace(Trim(strWord), Chr(7), "", , , 0)

But what you have done (by also removing chr(13)) will concatenate lines together if you have multi-line text and will leave little squares in place of any tab characters you have so it seems to be neither one thing nor the other.

I fear there's isn't any easy answer to your question, nor any completely right one.

Enjoy,
Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top