Remove Hidden Characters 
Author Message
 Remove Hidden Characters

I've got a word macro that compiles the text of several table cells.  The
problem is that the "selection" method grabs not only the cell text, but
also all of the hidden characters in that cell.  I would like to find a way
to remove these hidden characters.  I'm  wondering if there is a built in
function to remove them.  Or do I need to write a stripping routine that
checks for their presence and remove them as required?

Thanks,
Brian



Tue, 15 Nov 2005 06:51:09 GMT  
 Remove Hidden Characters
Hi Brian,

If by hidden characters you mean the end of cell marker, set a range equal
to the range of the cell and then use

yourcellrange.End = yourcellrange.End - 1

Please respond to the newsgroups for the benefit of others who may be
interested.

Hope this helps
Doug Robbins - Word MVP

Quote:
> I've got a word macro that compiles the text of several table cells.  The
> problem is that the "selection" method grabs not only the cell text, but
> also all of the hidden characters in that cell.  I would like to find a
way
> to remove these hidden characters.  I'm  wondering if there is a built in
> function to remove them.  Or do I need to write a stripping routine that
> checks for their presence and remove them as required?

> Thanks,
> Brian



Tue, 15 Nov 2005 07:43:06 GMT  
 Remove Hidden Characters
Brian,

Use:

Sub table_cell_text()
     Dim cellText As Range

    Set cellText =  ActiveDocument.Tables(1).Cell(2, 2).Range
    cellText.End = cell.Text.End - 1
    MsgBox cellText

 End Sub

Please respond to the newsgroups for the benefit of others who may be
interested.

Hope this helps
Doug Robbins - Word MVP

Quote:
----- Original Message -----


Sent: Friday, May 30, 2003 1:02 PM
Subject: RE: Remove Hidden Characters

> Doug,
> Thanks for the suggestion...  However, what you are suggesting doesn't
seem
> to be working for me.

> Here is a example of what I'm trying to do.

> Sub table_cell_text()
>     Dim cellText As String

>     ActiveDocument.Tables(1).Cell(2, 2).Select
>     cellText = Selection.Text

> End Sub

> cellText has hidden characters at the end and I need to remove them

> How do I make my selection a "range" as you suggest?

> I tried "Selection.Range.End -1" and I get a number returned based on
letter
> count I'm guessing.

> Could your provide a bit more guidance?  Thanks.
> Brian

> -----Original Message-----

> Sent: Thursday, May 29, 2003 4:43 PM
> To: Brian Stigler
> Subject: Re: Remove Hidden Characters

> Hi Brian,

> If by hidden characters you mean the end of cell marker, set a range equal
> to the range of the cell and then use

> yourcellrange.End = yourcellrange.End - 1

> Please respond to the newsgroups for the benefit of others who may be
> interested.

> Hope this helps
> Doug Robbins - Word MVP


> > I've got a word macro that compiles the text of several table cells.
The
> > problem is that the "selection" method grabs not only the cell text, but
> > also all of the hidden characters in that cell.  I would like to find a
> way
> > to remove these hidden characters.  I'm  wondering if there is a built
in
> > function to remove them.  Or do I need to write a stripping routine that
> > checks for their presence and remove them as required?

> > Thanks,
> > Brian



Tue, 15 Nov 2005 11:08:08 GMT  
 Remove Hidden Characters
Doug,
Thanks for the clarification.  I got it to work as I needed.

One more question if you don't mind...
is there a way to identify which cell that is currently selected?

I have the code to get the table index...  but it would be great if I could
get the row and column index of the cell that is currently selected.



Quote:
> Hi Brian,

> If by hidden characters you mean the end of cell marker, set a range equal
> to the range of the cell and then use

> yourcellrange.End = yourcellrange.End - 1

> Please respond to the newsgroups for the benefit of others who may be
> interested.

> Hope this helps
> Doug Robbins - Word MVP


> > I've got a word macro that compiles the text of several table cells.
The
> > problem is that the "selection" method grabs not only the cell text, but
> > also all of the hidden characters in that cell.  I would like to find a
> way
> > to remove these hidden characters.  I'm  wondering if there is a built
in
> > function to remove them.  Or do I need to write a stripping routine that
> > checks for their presence and remove them as required?

> > Thanks,
> > Brian



Tue, 15 Nov 2005 12:28:58 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Hide or Remove MS Agent Characters from Tray?

2. Question about removing character from text file

3. Remove Alpha Characters

4. Remove last 4 characters from a string

5. Removing a character from within a text string

6. Removing an unwanted character from a field

7. Remove all special characters from a string?

8. Remove last N characters from string

9. Remove control character from text file using qbasic

10. How to remove a specific character

11. remove characters from a string?

12. Remove certain characters from Textboxes

 

 
Powered by phpBB® Forum Software