formatting symbols?

J

James Wagman

I am using range.text to parse out text in a table to eventually throw
into Excel, but I keep getting the text with symbols either in front or
in back of (or both) it. I assume these are formatting symbols, and I
would like to either understand what they mean, be able to change them,
or strip them off. Any ideas?
 
J

Jay Freedman

James Wagman said:
I am using range.text to parse out text in a table to eventually throw
into Excel, but I keep getting the text with symbols either in front or
in back of (or both) it. I assume these are formatting symbols, and I
would like to either understand what they mean, be able to change them,
or strip them off. Any ideas?

Hi James,

If you're doing something like
myString = oTable.Cell(1,1).Range.Text
then you're getting the cell marker appearing as two garbage
characters at the end of the string. (If you turn on nonprinting
characters, the marker is the thing that looks like this: ¤

One way to get rid of it is to chop off the last two characters of the
string:
myString = Left$(myString, Len(myString) - 2)

Another way is to manipulate the range so it doesn't include the
marker. For this method, the marker for some reason appears as only
one character, not two:

Dim myRange As Range
Set myRange = oTable.Cell(1,1).Range
myRange.MoveEnd Unit:=wdCharacter, Count:=-1
myString = myRange.Text

If you're also getting garbage characters at the beginning of your
string, I have no idea where they're coming from. Are you sure the
range is pointing to the right place?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top