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  

Find Replace with Section Breaks



 
 
Thread Tools Display Modes
  #11  
Old September 17th, 2004, 07:39 PM
Jason L
external usenet poster
 
Posts: n/a
Default

Jean-Guy,

I guess I spoke too soon. When the section break is entered, a large space
is created beneath the word and the next paragraph or sentence. This is not
a huge deal, but the user is unhappy with it.

Here is the code I am using for the section break:

Const LookFor As String = "Recommendations:"

With ActiveDocument.Content.Find
.ClearFormatting
.Text = LookFor
With .Font
.Name = "Times New Roman"
.Bold = True
.Size = 11
End With
Do While .Execute
With .Parent
.Collapse wdCollapseEnd
.InsertBreak wdSectionBreakContinuous
.Collapse wdCollapseEnd


End With
Loop
End With

I tried to use something like this to remove the space (which has the
paragraph marker tied to the section break in this area), but it's not
working. Essentially, it looks like this:

RecommendationsSection break)
Paragraph Mark tied to section break

(New Text )

Thanks for any help you can give.

-Jason


"Jean-Guy Marcil" wrote:

Bonjour,

Dans son message, Jason L écrivait :
In this message, Jason L wrote:

|| Jean-Guy,
||
|| Actually, my colon wasn't bolded. Thanks so much for your help. This is
|| working great now.
||

Glad you sorted it out.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org




  #12  
Old September 17th, 2004, 08:34 PM
Jean-Guy Marcil
external usenet poster
 
Posts: n/a
Default

Bonjour,

Dans son message, Jason L écrivait :
In this message, Jason L wrote:

|| Jean-Guy,
||
|| I guess I spoke too soon. When the section break is entered, a large
space
|| is created beneath the word and the next paragraph or sentence. This is
not
|| a huge deal, but the user is unhappy with it.
||
|| Here is the code I am using for the section break:
||
|| Const LookFor As String = "Recommendations:"
||
|| With ActiveDocument.Content.Find
|| .ClearFormatting
|| .Text = LookFor
|| With .Font
|| .Name = "Times New Roman"
|| .Bold = True
|| .Size = 11
|| End With
|| Do While .Execute
|| With .Parent
|| .Collapse wdCollapseEnd
|| .InsertBreak wdSectionBreakContinuous
|| .Collapse wdCollapseEnd
||
||
|| End With
|| Loop
|| End With
||
|| I tried to use something like this to remove the space (which has the
|| paragraph marker tied to the section break in this area), but it's not
|| working. Essentially, it looks like this:
||
|| RecommendationsSection break)
|| Paragraph Mark tied to section break
||
|| (New Text )
||

That is probably due to paragraph spacing. Change the paragraph spacing (The
space after) for the Paragraph Mark tied to section break.

But let's go back a notch.
Why do you want to systematically insert section breaks after each word you
find?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org



  #13  
Old September 17th, 2004, 08:34 PM
Jean-Guy Marcil
external usenet poster
 
Posts: n/a
Default

Bonjour,

Dans son message, Jason L écrivait :
In this message, Jason L wrote:

|| Jean-Guy,
||
|| I guess I spoke too soon. When the section break is entered, a large
space
|| is created beneath the word and the next paragraph or sentence. This is
not
|| a huge deal, but the user is unhappy with it.
||
|| Here is the code I am using for the section break:
||
|| Const LookFor As String = "Recommendations:"
||
|| With ActiveDocument.Content.Find
|| .ClearFormatting
|| .Text = LookFor
|| With .Font
|| .Name = "Times New Roman"
|| .Bold = True
|| .Size = 11
|| End With
|| Do While .Execute
|| With .Parent
|| .Collapse wdCollapseEnd
|| .InsertBreak wdSectionBreakContinuous
|| .Collapse wdCollapseEnd
||
||
|| End With
|| Loop
|| End With
||
|| I tried to use something like this to remove the space (which has the
|| paragraph marker tied to the section break in this area), but it's not
|| working. Essentially, it looks like this:
||
|| RecommendationsSection break)
|| Paragraph Mark tied to section break
||
|| (New Text )
||

That is probably due to paragraph spacing. Change the paragraph spacing (The
space after) for the Paragraph Mark tied to section break.

But let's go back a notch.
Why do you want to systematically insert section breaks after each word you
find?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org



  #14  
Old September 17th, 2004, 08:49 PM
Jason L
external usenet poster
 
Posts: n/a
Default

Jean-Guy,

Good question. The words Recommendations and Discussion are the beginning
of new sections in this document. No matter how much the merged data
changes, these words always indicate the beginning of new sections. Each
numbered list in the section must start from 1. The insert section breaks
automatically restart the numbering for the following section. This is why
I'm using section breaks.

Here is how it looks before the section break:

Discussion:

1.dsfds
2.sdfdsa
3.sdfsdaf
4.sdfsf
5.dsfsd

Recommendations:
6.dsfsa
7.sdfdsfs
8.dsfdsafsad
9.sdfadfds

after section break is inserted:

Discussion:
1.dsfds
2.sdfdsa
3.sdfsdaf
4.sdfsf
5.dsfsd

Recommendations:
1.dsfsa
2.sdfdsfs
3.dsfdsafsad
4.sdfadfds

Does this help?

TIA,
Jason

"Jean-Guy Marcil" wrote:

Bonjour,

Dans son message, Jason L écrivait :
In this message, Jason L wrote:

|| Jean-Guy,
||
|| I guess I spoke too soon. When the section break is entered, a large
space
|| is created beneath the word and the next paragraph or sentence. This is
not
|| a huge deal, but the user is unhappy with it.
||
|| Here is the code I am using for the section break:
||
|| Const LookFor As String = "Recommendations:"
||
|| With ActiveDocument.Content.Find
|| .ClearFormatting
|| .Text = LookFor
|| With .Font
|| .Name = "Times New Roman"
|| .Bold = True
|| .Size = 11
|| End With
|| Do While .Execute
|| With .Parent
|| .Collapse wdCollapseEnd
|| .InsertBreak wdSectionBreakContinuous
|| .Collapse wdCollapseEnd
||
||
|| End With
|| Loop
|| End With
||
|| I tried to use something like this to remove the space (which has the
|| paragraph marker tied to the section break in this area), but it's not
|| working. Essentially, it looks like this:
||
|| RecommendationsSection break)
|| Paragraph Mark tied to section break
||
|| (New Text )
||

That is probably due to paragraph spacing. Change the paragraph spacing (The
space after) for the Paragraph Mark tied to section break.

But let's go back a notch.
Why do you want to systematically insert section breaks after each word you
find?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org




  #15  
Old September 17th, 2004, 08:49 PM
Jason L
external usenet poster
 
Posts: n/a
Default

Jean-Guy,

Good question. The words Recommendations and Discussion are the beginning
of new sections in this document. No matter how much the merged data
changes, these words always indicate the beginning of new sections. Each
numbered list in the section must start from 1. The insert section breaks
automatically restart the numbering for the following section. This is why
I'm using section breaks.

Here is how it looks before the section break:

Discussion:

1.dsfds
2.sdfdsa
3.sdfsdaf
4.sdfsf
5.dsfsd

Recommendations:
6.dsfsa
7.sdfdsfs
8.dsfdsafsad
9.sdfadfds

after section break is inserted:

Discussion:
1.dsfds
2.sdfdsa
3.sdfsdaf
4.sdfsf
5.dsfsd

Recommendations:
1.dsfsa
2.sdfdsfs
3.dsfdsafsad
4.sdfadfds

Does this help?

TIA,
Jason

"Jean-Guy Marcil" wrote:

Bonjour,

Dans son message, Jason L écrivait :
In this message, Jason L wrote:

|| Jean-Guy,
||
|| I guess I spoke too soon. When the section break is entered, a large
space
|| is created beneath the word and the next paragraph or sentence. This is
not
|| a huge deal, but the user is unhappy with it.
||
|| Here is the code I am using for the section break:
||
|| Const LookFor As String = "Recommendations:"
||
|| With ActiveDocument.Content.Find
|| .ClearFormatting
|| .Text = LookFor
|| With .Font
|| .Name = "Times New Roman"
|| .Bold = True
|| .Size = 11
|| End With
|| Do While .Execute
|| With .Parent
|| .Collapse wdCollapseEnd
|| .InsertBreak wdSectionBreakContinuous
|| .Collapse wdCollapseEnd
||
||
|| End With
|| Loop
|| End With
||
|| I tried to use something like this to remove the space (which has the
|| paragraph marker tied to the section break in this area), but it's not
|| working. Essentially, it looks like this:
||
|| RecommendationsSection break)
|| Paragraph Mark tied to section break
||
|| (New Text )
||

That is probably due to paragraph spacing. Change the paragraph spacing (The
space after) for the Paragraph Mark tied to section break.

But let's go back a notch.
Why do you want to systematically insert section breaks after each word you
find?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org




  #16  
Old September 17th, 2004, 10:44 PM
Jean-Guy Marcil
external usenet poster
 
Posts: n/a
Default

Bonjour,

Dans son message, Jason L écrivait :
In this message, Jason L wrote:

|| Jean-Guy,
||
|| Good question. The words Recommendations and Discussion are the
beginning
|| of new sections in this document. No matter how much the merged data
|| changes, these words always indicate the beginning of new sections.
Each
|| numbered list in the section must start from 1. The insert section
breaks
|| automatically restart the numbering for the following section. This is
why
|| I'm using section breaks.
||
|| Here is how it looks before the section break:
||
|| Discussion:
||
|| 1.dsfds
|| 2.sdfdsa
|| 3.sdfsdaf
|| 4.sdfsf
|| 5.dsfsd
||
|| Recommendations:
|| 6.dsfsa
|| 7.sdfdsfs
|| 8.dsfdsafsad
|| 9.sdfadfds
||
|| after section break is inserted:
||
|| Discussion:
|| 1.dsfds
|| 2.sdfdsa
|| 3.sdfsdaf
|| 4.sdfsf
|| 5.dsfsd
||
|| Recommendations:
|| 1.dsfsa
|| 2.sdfdsfs
|| 3.dsfdsafsad
|| 4.sdfadfds
||
|| Does this help?
||

Then, shouldn't the section break be placed before the key word? Also, on my
machine, inserting a section breaks does not automatically restart the
numbering? How do you do that?

Also, you could restart the numbering after each key word?
But for this, you need a very robust document and you have to make sure that
all numbering was done from the same list template. In fact, it would be
better if you created your own list template and applied it to the
numbering.

In any case, here is some code you could adapt for such a scenario:

'_______________________________________
Sub RestartNumberingAfterKeyWord()
Const LookFor As String = "Recommendations:"
Dim FoundRange As Range

With ActiveDocument.Content.Find
.ClearFormatting
.Text = LookFor
With .Font
.Name = "Times New Roman"
.Bold = True
.Size = 11
End With
Do While .Execute
With .Parent
Set FoundRange = .Paragraphs(1).Range
With FoundRange
.MoveStart wdParagraph
If .ListFormat.ListValue 1 Then
Dim MyListTemp As ListTemplate
Set MyListTemp = .ListFormat.ListTemplate
.ListFormat.ApplyListTemplate _
ListTemplate:=MyListTemp, _
ContinuePreviousList:=False
End If
End With
End With
Loop
End With
End Sub
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org



  #17  
Old September 17th, 2004, 10:44 PM
Jean-Guy Marcil
external usenet poster
 
Posts: n/a
Default

Bonjour,

Dans son message, Jason L écrivait :
In this message, Jason L wrote:

|| Jean-Guy,
||
|| Good question. The words Recommendations and Discussion are the
beginning
|| of new sections in this document. No matter how much the merged data
|| changes, these words always indicate the beginning of new sections.
Each
|| numbered list in the section must start from 1. The insert section
breaks
|| automatically restart the numbering for the following section. This is
why
|| I'm using section breaks.
||
|| Here is how it looks before the section break:
||
|| Discussion:
||
|| 1.dsfds
|| 2.sdfdsa
|| 3.sdfsdaf
|| 4.sdfsf
|| 5.dsfsd
||
|| Recommendations:
|| 6.dsfsa
|| 7.sdfdsfs
|| 8.dsfdsafsad
|| 9.sdfadfds
||
|| after section break is inserted:
||
|| Discussion:
|| 1.dsfds
|| 2.sdfdsa
|| 3.sdfsdaf
|| 4.sdfsf
|| 5.dsfsd
||
|| Recommendations:
|| 1.dsfsa
|| 2.sdfdsfs
|| 3.dsfdsafsad
|| 4.sdfadfds
||
|| Does this help?
||

Then, shouldn't the section break be placed before the key word? Also, on my
machine, inserting a section breaks does not automatically restart the
numbering? How do you do that?

Also, you could restart the numbering after each key word?
But for this, you need a very robust document and you have to make sure that
all numbering was done from the same list template. In fact, it would be
better if you created your own list template and applied it to the
numbering.

In any case, here is some code you could adapt for such a scenario:

'_______________________________________
Sub RestartNumberingAfterKeyWord()
Const LookFor As String = "Recommendations:"
Dim FoundRange As Range

With ActiveDocument.Content.Find
.ClearFormatting
.Text = LookFor
With .Font
.Name = "Times New Roman"
.Bold = True
.Size = 11
End With
Do While .Execute
With .Parent
Set FoundRange = .Paragraphs(1).Range
With FoundRange
.MoveStart wdParagraph
If .ListFormat.ListValue 1 Then
Dim MyListTemp As ListTemplate
Set MyListTemp = .ListFormat.ListTemplate
.ListFormat.ApplyListTemplate _
ListTemplate:=MyListTemp, _
ContinuePreviousList:=False
End If
End With
End With
Loop
End With
End Sub
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org



  #18  
Old September 19th, 2004, 04:25 AM
Suzanne S. Barnhill
external usenet poster
 
Posts: n/a
Default

In this case, you would be much better advised to use ordinary methods of
restarting numbering. This would require applying to the Recommendations and
Discussion paragraphs at Level 1 outline numbering style (it need not be
numbered), with the numbered lists as Level 2. For more, see
http://www.shaunakelly.com/word/numb...Numbering.html and
http://www.syntagma.demon.co.uk/FAQs...artMethods.htm
--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Jason L" wrote in message
...
Jean-Guy,

Good question. The words Recommendations and Discussion are the beginning
of new sections in this document. No matter how much the merged data
changes, these words always indicate the beginning of new sections. Each
numbered list in the section must start from 1. The insert section breaks
automatically restart the numbering for the following section. This is

why
I'm using section breaks.

Here is how it looks before the section break:

Discussion:

1.dsfds
2.sdfdsa
3.sdfsdaf
4.sdfsf
5.dsfsd

Recommendations:
6.dsfsa
7.sdfdsfs
8.dsfdsafsad
9.sdfadfds

after section break is inserted:

Discussion:
1.dsfds
2.sdfdsa
3.sdfsdaf
4.sdfsf
5.dsfsd

Recommendations:
1.dsfsa
2.sdfdsfs
3.dsfdsafsad
4.sdfadfds

Does this help?

TIA,
Jason

"Jean-Guy Marcil" wrote:

Bonjour,

Dans son message, Jason L écrivait :
In this message, Jason L wrote:

|| Jean-Guy,
||
|| I guess I spoke too soon. When the section break is entered, a large
space
|| is created beneath the word and the next paragraph or sentence. This

is
not
|| a huge deal, but the user is unhappy with it.
||
|| Here is the code I am using for the section break:
||
|| Const LookFor As String = "Recommendations:"
||
|| With ActiveDocument.Content.Find
|| .ClearFormatting
|| .Text = LookFor
|| With .Font
|| .Name = "Times New Roman"
|| .Bold = True
|| .Size = 11
|| End With
|| Do While .Execute
|| With .Parent
|| .Collapse wdCollapseEnd
|| .InsertBreak wdSectionBreakContinuous
|| .Collapse wdCollapseEnd
||
||
|| End With
|| Loop
|| End With
||
|| I tried to use something like this to remove the space (which has the
|| paragraph marker tied to the section break in this area), but it's

not
|| working. Essentially, it looks like this:
||
|| RecommendationsSection break)
|| Paragraph Mark tied to section break
||
|| (New Text )
||

That is probably due to paragraph spacing. Change the paragraph spacing

(The
space after) for the Paragraph Mark tied to section break.

But let's go back a notch.
Why do you want to systematically insert section breaks after each word

you
find?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org





  #19  
Old September 19th, 2004, 04:25 AM
Suzanne S. Barnhill
external usenet poster
 
Posts: n/a
Default

In this case, you would be much better advised to use ordinary methods of
restarting numbering. This would require applying to the Recommendations and
Discussion paragraphs at Level 1 outline numbering style (it need not be
numbered), with the numbered lists as Level 2. For more, see
http://www.shaunakelly.com/word/numb...Numbering.html and
http://www.syntagma.demon.co.uk/FAQs...artMethods.htm
--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Jason L" wrote in message
...
Jean-Guy,

Good question. The words Recommendations and Discussion are the beginning
of new sections in this document. No matter how much the merged data
changes, these words always indicate the beginning of new sections. Each
numbered list in the section must start from 1. The insert section breaks
automatically restart the numbering for the following section. This is

why
I'm using section breaks.

Here is how it looks before the section break:

Discussion:

1.dsfds
2.sdfdsa
3.sdfsdaf
4.sdfsf
5.dsfsd

Recommendations:
6.dsfsa
7.sdfdsfs
8.dsfdsafsad
9.sdfadfds

after section break is inserted:

Discussion:
1.dsfds
2.sdfdsa
3.sdfsdaf
4.sdfsf
5.dsfsd

Recommendations:
1.dsfsa
2.sdfdsfs
3.dsfdsafsad
4.sdfadfds

Does this help?

TIA,
Jason

"Jean-Guy Marcil" wrote:

Bonjour,

Dans son message, Jason L écrivait :
In this message, Jason L wrote:

|| Jean-Guy,
||
|| I guess I spoke too soon. When the section break is entered, a large
space
|| is created beneath the word and the next paragraph or sentence. This

is
not
|| a huge deal, but the user is unhappy with it.
||
|| Here is the code I am using for the section break:
||
|| Const LookFor As String = "Recommendations:"
||
|| With ActiveDocument.Content.Find
|| .ClearFormatting
|| .Text = LookFor
|| With .Font
|| .Name = "Times New Roman"
|| .Bold = True
|| .Size = 11
|| End With
|| Do While .Execute
|| With .Parent
|| .Collapse wdCollapseEnd
|| .InsertBreak wdSectionBreakContinuous
|| .Collapse wdCollapseEnd
||
||
|| End With
|| Loop
|| End With
||
|| I tried to use something like this to remove the space (which has the
|| paragraph marker tied to the section break in this area), but it's

not
|| working. Essentially, it looks like this:
||
|| RecommendationsSection break)
|| Paragraph Mark tied to section break
||
|| (New Text )
||

That is probably due to paragraph spacing. Change the paragraph spacing

(The
space after) for the Paragraph Mark tied to section break.

But let's go back a notch.
Why do you want to systematically insert section breaks after each word

you
find?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
ISTOO
Word MVP site:
http://www.word.mvps.org





 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Find and Replace Nelson Ferry General Discussion 2 August 17th, 2004 04:09 PM
find and replace ladyinred General Discussion 14 August 12th, 2004 09:35 PM
Advanced find and replace - Word XP Melissa General Discussions 4 May 10th, 2004 02:45 PM
find all / replace all used in a selected range oldguy Worksheet Functions 0 February 26th, 2004 02:05 PM
find all / replace all used in a selected range Tom Turtle Worksheet Functions 0 February 26th, 2004 11:11 AM


All times are GMT +1. The time now is 09:51 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.