Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.pagelayout
Adelle Gibson Adelle Gibson is offline
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   Report Post  
Posted to microsoft.public.word.pagelayout
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
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   Report Post  
Posted to microsoft.public.word.pagelayout
Adelle Gibson Adelle Gibson is offline
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   Report Post  
Posted to microsoft.public.word.pagelayout
Adelle Gibson Adelle Gibson is offline
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   Report Post  
Posted to microsoft.public.word.pagelayout
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
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   Report Post  
Posted to microsoft.public.word.pagelayout
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
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


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
search and replace multiple files shortcutnut Microsoft Word Help 2 September 17th 09 09:57 PM
I need to search and replace across multiple files TITANI Microsoft Word Help 3 November 29th 07 02:35 PM
find/replace multiple TABS GKW in GA Microsoft Word Help 4 May 5th 07 06:00 AM
Search and Replace in Multiple Files gctm Microsoft Word Help 6 April 28th 07 07:29 AM
How do I search and replace tabs with spaces? crazysher Microsoft Word Help 3 September 8th 06 03:43 AM


All times are GMT +1. The time now is 02:18 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"