A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Page Layout
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to search and replace multiple tabs



 
 
Thread Tools Display Modes
  #1  
Old December 23rd, 2009, 04:51 AM posted to microsoft.public.word.pagelayout
Adelle Gibson
external usenet poster
 
Posts: 3
Default How to search and replace multiple tabs

I am trying to create a macro to search and replace one tab with two in a TOC. Problem is I currently have three tabs set in the paragraph and the one that I want to replace is the second tab. When I run the search and replace it changes the first tab to two. Any ideas on how to get around this problem.

Ex (current):
1.(tab)text(leader tab)digit

Ex (desired):
1.(tab)text(leader tab)(tab)digit


Submitted via EggHeadCafe - Software Developer Portal of Choice
ASP.NET: Hamburger, Yes! AJAX, "NOT!", Redux!
http://www.eggheadcafe.com/tutorials...urger-yes.aspx
  #2  
Old December 23rd, 2009, 06:37 AM posted to microsoft.public.word.pagelayout
macropod[_2_]
external usenet poster
 
Posts: 2,402
Default How to search and replace multiple tabs

Hi Adelle,

For a TOC field, the 'correct' way is to edit the relevant TOC Styles. Otherwise the tabs are liable to reappear as soon as you
update the TOC field.

If the tabs are in the headings being picked up by the TOC, though, you'll need to either edit the headings themselves or change the
TOC Style to that the two tabs are effectively treated as one (eg by placing the corresponding tab stops as close together as
possible - which seems to be about 1.25pts apart).

--
Cheers
macropod
[Microsoft MVP - Word]


"Adelle Gibson" wrote in message ...
I am trying to create a macro to search and replace one tab with two in a TOC. Problem is I currently have three tabs set in the
paragraph and the one that I want to replace is the second tab. When I run the search and replace it changes the first tab to two.
Any ideas on how to get around this problem.

Ex (current):
1.(tab)text(leader tab)digit

Ex (desired):
1.(tab)text(leader tab)(tab)digit


Submitted via EggHeadCafe - Software Developer Portal of Choice
ASP.NET: Hamburger, Yes! AJAX, "NOT!", Redux!
http://www.eggheadcafe.com/tutorials...urger-yes.aspx


  #3  
Old February 12th, 2010, 03:59 AM posted to microsoft.public.word.pagelayout
Adelle Gibson
external usenet poster
 
Posts: 3
Default Macro help!

Thanks for your help.

After I generate a TOC I usually unlink it so that I can insert the section number and a hyphen before the page number. I can't use Word's built-in option for this since the client does not use auto numbering at all.

Here's an example of what I am trying to do.

1. Text.......... 1-1

Can someone help me write a macro that will (1) insert a tab, (2) pick up the first number on that line (i.e., 1), (3) add a hyphen before the page number.

If it helps, the blank space between the leader tab (set at 6.5) and 1-1 is actually a right-aligned tab set at 7.0.

I currently have to input this information manually throughout the entire TOC which, as you may have guessed, is a pain when it is 5 pages long.



macropod wrote:

Hi Adelle,For a TOC field, the 'correct' way is to edit the relevant TOC
23-Dec-09

Hi Adelle,

For a TOC field, the 'correct' way is to edit the relevant TOC Styles. Otherwise the tabs are liable to reappear as soon as you
update the TOC field.

If the tabs are in the headings being picked up by the TOC, though, you will need to either edit the headings themselves or change the
TOC Style to that the two tabs are effectively treated as one (eg by placing the corresponding tab stops as close together as
possible - which seems to be about 1.25pts apart).

--
Cheers
macropod
[Microsoft MVP - Word]

Previous Posts In This Thread:

On Tuesday, December 22, 2009 11:51 PM
Adelle Gibson wrote:

How to search and replace multiple tabs
I am trying to create a macro to search and replace one tab with two in a TOC. Problem is I currently have three tabs set in the paragraph and the one that I want to replace is the second tab. When I run the search and replace it changes the first tab to two. Any ideas on how to get around this problem.

Ex (current):
1.(tab)text(leader tab)digit

Ex (desired):
1.(tab)text(leader tab)(tab)digit

On Wednesday, December 23, 2009 1:37 AM
macropod wrote:

Hi Adelle,For a TOC field, the 'correct' way is to edit the relevant TOC
Hi Adelle,

For a TOC field, the 'correct' way is to edit the relevant TOC Styles. Otherwise the tabs are liable to reappear as soon as you
update the TOC field.

If the tabs are in the headings being picked up by the TOC, though, you will need to either edit the headings themselves or change the
TOC Style to that the two tabs are effectively treated as one (eg by placing the corresponding tab stops as close together as
possible - which seems to be about 1.25pts apart).

--
Cheers
macropod
[Microsoft MVP - Word]


Submitted via EggHeadCafe - Software Developer Portal of Choice
How to display a Gravatar Image with 100 Percent Client Script Code
http://www.eggheadcafe.com/tutorials...-gravatar.aspx
  #4  
Old February 12th, 2010, 04:00 AM posted to microsoft.public.word.pagelayout
Adelle Gibson
external usenet poster
 
Posts: 3
Default Macro help!

Thanks for your help.

After I generate a TOC I usually unlink it so that I can insert the section number and a hyphen before the page number. I can't use Word's built-in option for this since the client does not use auto numbering at all.

Here's an example of what I am trying to do.

1. Text.......... 1-1

Can someone help me write a macro that will (1) insert a tab, (2) pick up the first number on that line (i.e., 1), (3) add a hyphen before the page number.

If it helps, the blank space between the leader tab (set at 6.5) and 1-1 is actually a right-aligned tab set at 7.0.

I currently have to input this information manually throughout the entire TOC which, as you may have guessed, is a pain when it is 5 pages long.



macropod wrote:

Hi Adelle,For a TOC field, the 'correct' way is to edit the relevant TOC
23-Dec-09

Hi Adelle,

For a TOC field, the 'correct' way is to edit the relevant TOC Styles. Otherwise the tabs are liable to reappear as soon as you
update the TOC field.

If the tabs are in the headings being picked up by the TOC, though, you will need to either edit the headings themselves or change the
TOC Style to that the two tabs are effectively treated as one (eg by placing the corresponding tab stops as close together as
possible - which seems to be about 1.25pts apart).

--
Cheers
macropod
[Microsoft MVP - Word]

Previous Posts In This Thread:

On Tuesday, December 22, 2009 11:51 PM
Adelle Gibson wrote:

How to search and replace multiple tabs
I am trying to create a macro to search and replace one tab with two in a TOC. Problem is I currently have three tabs set in the paragraph and the one that I want to replace is the second tab. When I run the search and replace it changes the first tab to two. Any ideas on how to get around this problem.

Ex (current):
1.(tab)text(leader tab)digit

Ex (desired):
1.(tab)text(leader tab)(tab)digit

On Wednesday, December 23, 2009 1:37 AM
macropod wrote:

Hi Adelle,For a TOC field, the 'correct' way is to edit the relevant TOC
Hi Adelle,

For a TOC field, the 'correct' way is to edit the relevant TOC Styles. Otherwise the tabs are liable to reappear as soon as you
update the TOC field.

If the tabs are in the headings being picked up by the TOC, though, you will need to either edit the headings themselves or change the
TOC Style to that the two tabs are effectively treated as one (eg by placing the corresponding tab stops as close together as
possible - which seems to be about 1.25pts apart).

--
Cheers
macropod
[Microsoft MVP - Word]

On Thursday, February 11, 2010 10:59 PM
Adelle Gibson wrote:

Macro help!
Thanks for your help.

After I generate a TOC I usually unlink it so that I can insert the section number and a hyphen before the page number. I can't use Word's built-in option for this since the client does not use auto numbering at all.

Here's an example of what I am trying to do.

1. Text.......... 1-1

Can someone help me write a macro that will (1) insert a tab, (2) pick up the first number on that line (i.e., 1), (3) add a hyphen before the page number.

If it helps, the blank space between the leader tab (set at 6.5) and 1-1 is actually a right-aligned tab set at 7.0.

I currently have to input this information manually throughout the entire TOC which, as you may have guessed, is a pain when it is 5 pages long.


Submitted via EggHeadCafe - Software Developer Portal of Choice
Create Hidden SharePoint List for Site Owners
http://www.eggheadcafe.com/tutorials...harepoint.aspx
  #5  
Old February 12th, 2010, 05:44 AM posted to microsoft.public.word.pagelayout
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
Default Macro help!

A macro is probably not the correct thing to use. Rather, after unlinking
the table of contents, select the entries for each section in turn and then
use EditReplace with the Use wildcards box checked and search for

^t([0-9]{1,})

and replace it with

^t#-\1

where in place of the # you put the number of the section. For example for
Section 1, use

^t1-\1

A macro would not know where to change from 1- to 2- etc.

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.

"Adelle Gibson" wrote in message ...
Thanks for your help.

After I generate a TOC I usually unlink it so that I can insert the
section number and a hyphen before the page number. I can't use Word's
built-in option for this since the client does not use auto numbering at
all.

Here's an example of what I am trying to do.

1. Text.......... 1-1

Can someone help me write a macro that will (1) insert a tab, (2) pick up
the first number on that line (i.e., 1), (3) add a hyphen before the page
number.

If it helps, the blank space between the leader tab (set at 6.5) and 1-1
is actually a right-aligned tab set at 7.0.

I currently have to input this information manually throughout the entire
TOC which, as you may have guessed, is a pain when it is 5 pages long.



macropod wrote:

Hi Adelle,For a TOC field, the 'correct' way is to edit the relevant TOC
23-Dec-09

Hi Adelle,

For a TOC field, the 'correct' way is to edit the relevant TOC Styles.
Otherwise the tabs are liable to reappear as soon as you
update the TOC field.

If the tabs are in the headings being picked up by the TOC, though, you
will need to either edit the headings themselves or change the
TOC Style to that the two tabs are effectively treated as one (eg by
placing the corresponding tab stops as close together as
possible - which seems to be about 1.25pts apart).

--
Cheers
macropod
[Microsoft MVP - Word]

Previous Posts In This Thread:

On Tuesday, December 22, 2009 11:51 PM
Adelle Gibson wrote:

How to search and replace multiple tabs
I am trying to create a macro to search and replace one tab with two in a
TOC. Problem is I currently have three tabs set in the paragraph and the
one that I want to replace is the second tab. When I run the search and
replace it changes the first tab to two. Any ideas on how to get around
this problem.

Ex (current):
1.(tab)text(leader tab)digit

Ex (desired):
1.(tab)text(leader tab)(tab)digit

On Wednesday, December 23, 2009 1:37 AM
macropod wrote:

Hi Adelle,For a TOC field, the 'correct' way is to edit the relevant TOC
Hi Adelle,

For a TOC field, the 'correct' way is to edit the relevant TOC Styles.
Otherwise the tabs are liable to reappear as soon as you
update the TOC field.

If the tabs are in the headings being picked up by the TOC, though, you
will need to either edit the headings themselves or change the
TOC Style to that the two tabs are effectively treated as one (eg by
placing the corresponding tab stops as close together as
possible - which seems to be about 1.25pts apart).

--
Cheers
macropod
[Microsoft MVP - Word]


Submitted via EggHeadCafe - Software Developer Portal of Choice
How to display a Gravatar Image with 100 Percent Client Script Code
http://www.eggheadcafe.com/tutorials...-gravatar.aspx


  #6  
Old February 12th, 2010, 05:55 AM posted to microsoft.public.word.pagelayout
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
Default Macro help!

Actually, if you select the whole of what was the table of contents and do a
wildcard search for

^t([0-9]{1,})^13([0-9]{1,}).

and replace it with

^t\2-\1^p\2.

it should modify all but the last page number in the table of contents.

For an explanation, see the Find and Replace using Wildcards article on the
following page of fellow MVP Graham Mayor's website:

http://www.gmayor.com/replace_using_wildcards.htm

--
Hope this helps,

Doug Robbins - Word MVP

Please reply only to the newsgroups unless you wish to obtain my services on
a paid professional basis.

"Adelle Gibson" wrote in message ...
Thanks for your help.

After I generate a TOC I usually unlink it so that I can insert the
section number and a hyphen before the page number. I can't use Word's
built-in option for this since the client does not use auto numbering at
all.

Here's an example of what I am trying to do.

1. Text.......... 1-1

Can someone help me write a macro that will (1) insert a tab, (2) pick up
the first number on that line (i.e., 1), (3) add a hyphen before the page
number.

If it helps, the blank space between the leader tab (set at 6.5) and 1-1
is actually a right-aligned tab set at 7.0.

I currently have to input this information manually throughout the entire
TOC which, as you may have guessed, is a pain when it is 5 pages long.



macropod wrote:

Hi Adelle,For a TOC field, the 'correct' way is to edit the relevant TOC
23-Dec-09

Hi Adelle,

For a TOC field, the 'correct' way is to edit the relevant TOC Styles.
Otherwise the tabs are liable to reappear as soon as you
update the TOC field.

If the tabs are in the headings being picked up by the TOC, though, you
will need to either edit the headings themselves or change the
TOC Style to that the two tabs are effectively treated as one (eg by
placing the corresponding tab stops as close together as
possible - which seems to be about 1.25pts apart).

--
Cheers
macropod
[Microsoft MVP - Word]

Previous Posts In This Thread:

On Tuesday, December 22, 2009 11:51 PM
Adelle Gibson wrote:

How to search and replace multiple tabs
I am trying to create a macro to search and replace one tab with two in a
TOC. Problem is I currently have three tabs set in the paragraph and the
one that I want to replace is the second tab. When I run the search and
replace it changes the first tab to two. Any ideas on how to get around
this problem.

Ex (current):
1.(tab)text(leader tab)digit

Ex (desired):
1.(tab)text(leader tab)(tab)digit

On Wednesday, December 23, 2009 1:37 AM
macropod wrote:

Hi Adelle,For a TOC field, the 'correct' way is to edit the relevant TOC
Hi Adelle,

For a TOC field, the 'correct' way is to edit the relevant TOC Styles.
Otherwise the tabs are liable to reappear as soon as you
update the TOC field.

If the tabs are in the headings being picked up by the TOC, though, you
will need to either edit the headings themselves or change the
TOC Style to that the two tabs are effectively treated as one (eg by
placing the corresponding tab stops as close together as
possible - which seems to be about 1.25pts apart).

--
Cheers
macropod
[Microsoft MVP - Word]

On Thursday, February 11, 2010 10:59 PM
Adelle Gibson wrote:

Macro help!
Thanks for your help.

After I generate a TOC I usually unlink it so that I can insert the
section number and a hyphen before the page number. I can't use Word's
built-in option for this since the client does not use auto numbering at
all.

Here's an example of what I am trying to do.

1. Text.......... 1-1

Can someone help me write a macro that will (1) insert a tab, (2) pick up
the first number on that line (i.e., 1), (3) add a hyphen before the page
number.

If it helps, the blank space between the leader tab (set at 6.5) and 1-1
is actually a right-aligned tab set at 7.0.

I currently have to input this information manually throughout the entire
TOC which, as you may have guessed, is a pain when it is 5 pages long.


Submitted via EggHeadCafe - Software Developer Portal of Choice
Create Hidden SharePoint List for Site Owners
http://www.eggheadcafe.com/tutorials...harepoint.aspx


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:41 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.