Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2005

Tip: Looking for answers? Try searching our database.

search and replace tabs in table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hines - 24 Jan 2005 17:57 GMT
I'd like to create a macro that searches a table column for commas and
replaces them with tabs.  I'm not a programmer and only create my macros
using the record function although I can edit VB if I have the right command
language.
Klaus Linke - 24 Jan 2005 21:18 GMT
Hi,

If you record the macro (Table > Select > Column, Edit > Find, Replace "," with
"^t"), the macro should work fine.
All you'd need to change is replace
.Wrap = wdFindAsk
with
.Wrap = wdFindStop

If you want to search in a certain column, and not the column the cursor happens
to be in, you can select that column at the start of the macro:
Instead of
   Selection.SelectColumn
use
   Selection.Tables(1).Columns(4).Select
to select, say, the 4th column.

Regards,
Klaus

> I'd like to create a macro that searches a table column for commas and
> replaces them with tabs.  I'm not a programmer and only create my macros
> using the record function although I can edit VB if I have the right command
> language.
hinesgg - 24 Jan 2005 23:37 GMT
That worked, but now I have a new problem.  My column originally contained a
list of names separated by commas.  The column is a fixed width, and when the
commas are replaced by tabs, some of the names don't wrap to a new line.  
Instead, they just continue as if the first names were part of the last name
that appeared before them.  I'm trying to find a way to avoid the need to
manually enter a soft return in each situation.  Any advice?

> Hi,
>
[quoted text clipped - 20 lines]
> > using the record function although I can edit VB if I have the right command
> > language.
Klaus Linke - 25 Jan 2005 22:48 GMT
> That worked, but now I have a new problem.  My column originally
> contained a list of names separated by commas.
[quoted text clipped - 3 lines]
> before them.  I'm trying to find a way to avoid the need to manually
> enter a soft return in each situation.  Any advice?

You could force a minimal distance by replacing the tabs with a space and a tab.

But the cleaner solution would be to use two columns? If you convert the table
to (tab-delimited) text, and then back to a table, that should be quick.

Greetings,
Klaus

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.