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 » Formatting Long Documents
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Format between Styles



 
 
Thread Tools Display Modes
  #1  
Old September 18th, 2005, 04:15 AM
external usenet poster
 
Posts: n/a
Default Format between Styles

I have a long document (several thousand pages) that has heads using
Heading Style 1 through Heading Style 5. I would like to apply a
style to the body text between Heading 2 and Heading 3.

Is there a way to set up a Find/Replace to do that for me?

*(((({

  #2  
Old September 18th, 2005, 08:17 PM
Herb Tyson [MVP]
external usenet poster
 
Posts: n/a
Default Format between Styles

Not unless there's some unique text in every Heading 2 and Heading 3
heading. Find/Replace lets you find a style, but only one per find. Hence,
you can locate Heading 2 or Heading 3, but not both (and certainly not with
something else sandwiched in-between). Wildcard searches are really good
with text patterns, but limited when it comes to formatting patterns.

It wouldn't be terribly hard to set up a macro to do it, however.

--
Herb Tyson MS MVP
Please respond in the newsgroups so everyone can follow along.
http://www.herbtyson.com
"*((({" wrote in message
...
I have a long document (several thousand pages) that has heads using
Heading Style 1 through Heading Style 5. I would like to apply a
style to the body text between Heading 2 and Heading 3.

Is there a way to set up a Find/Replace to do that for me?

*(((({



  #3  
Old September 18th, 2005, 10:03 PM
Greg Maxey
external usenet poster
 
Posts: n/a
Default Format between Styles

While it was probably harder for me than Herb can imagine, I think I finally
figured it out.

Try:
Sub ApplyNewStyleBetweenTweUniqueStyles()
Dim oRng As Range
Dim oTempRng As Range
Set oRng = ActiveDocument.Content
With oRng.Find
'Look for the Heading 2 text on execute
.Style = "Heading 2"
.Wrap = wdFindStop
While .Execute
'Collapse oRng to end of found Heading 2 text
oRng.Collapse wdCollapseEnd
'Set a temporary range that starts at end of Heading 2 text
Set oTempRng = oRng.Duplicate
'Look for Heading 3 text on execute
.Style = "Heading 3"
.Execute
'Collapse oRng to start of Heading 3 text
oRng.Collapse wdCollapseStart
'Define temporary range that ends where Heading 3 text starts
oTempRng.End = oRng.End
'Apply style
oTempRng.Style = "MyStyle"
'Set execute to look for Heading 2 text
.Style = "Heading 2"
Wend
End With
End Sub

Where "MyStyle" is the name of the style you want to apply.


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

Herb Tyson [MVP] wrote:
Not unless there's some unique text in every Heading 2 and Heading 3
heading. Find/Replace lets you find a style, but only one per find.
Hence, you can locate Heading 2 or Heading 3, but not both (and
certainly not with something else sandwiched in-between). Wildcard
searches are really good with text patterns, but limited when it
comes to formatting patterns.
It wouldn't be terribly hard to set up a macro to do it, however.

I have a long document (several thousand pages) that has heads using
Heading Style 1 through Heading Style 5. I would like to apply a
style to the body text between Heading 2 and Heading 3.

Is there a way to set up a Find/Replace to do that for me?

*(((({



  #4  
Old September 18th, 2005, 10:48 PM
Herb Tyson [MVP]
external usenet poster
 
Posts: n/a
Default Format between Styles

Wow! That's surprisingly similar to the one that took me 30 seconds to
record.

JUST KIDDING!!!

;-)

--
Herb Tyson MS MVP
Please respond in the newsgroups so everyone can follow along.
http://www.herbtyson.com
"Greg Maxey" wrote in message
...
While it was probably harder for me than Herb can imagine, I think I
finally figured it out.

Try:
Sub ApplyNewStyleBetweenTweUniqueStyles()
Dim oRng As Range
Dim oTempRng As Range
Set oRng = ActiveDocument.Content
With oRng.Find
'Look for the Heading 2 text on execute
.Style = "Heading 2"
.Wrap = wdFindStop
While .Execute
'Collapse oRng to end of found Heading 2 text
oRng.Collapse wdCollapseEnd
'Set a temporary range that starts at end of Heading 2 text
Set oTempRng = oRng.Duplicate
'Look for Heading 3 text on execute
.Style = "Heading 3"
.Execute
'Collapse oRng to start of Heading 3 text
oRng.Collapse wdCollapseStart
'Define temporary range that ends where Heading 3 text starts
oTempRng.End = oRng.End
'Apply style
oTempRng.Style = "MyStyle"
'Set execute to look for Heading 2 text
.Style = "Heading 2"
Wend
End With
End Sub

Where "MyStyle" is the name of the style you want to apply.


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

Herb Tyson [MVP] wrote:
Not unless there's some unique text in every Heading 2 and Heading 3
heading. Find/Replace lets you find a style, but only one per find.
Hence, you can locate Heading 2 or Heading 3, but not both (and
certainly not with something else sandwiched in-between). Wildcard
searches are really good with text patterns, but limited when it
comes to formatting patterns.
It wouldn't be terribly hard to set up a macro to do it, however.

I have a long document (several thousand pages) that has heads using
Heading Style 1 through Heading Style 5. I would like to apply a
style to the body text between Heading 2 and Heading 3.

Is there a way to set up a Find/Replace to do that for me?

*(((({





  #5  
Old September 18th, 2005, 10:53 PM
Greg Maxey
external usenet poster
 
Posts: n/a
Default Format between Styles

Yoouuuu!!!
That "Just Kidding" line was the only thing that kept a vein from bursting
;-)

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

Herb Tyson [MVP] wrote:
Wow! That's surprisingly similar to the one that took me 30 seconds to
record.

JUST KIDDING!!!

;-)

While it was probably harder for me than Herb can imagine, I think I
finally figured it out.

Try:
Sub ApplyNewStyleBetweenTweUniqueStyles()
Dim oRng As Range
Dim oTempRng As Range
Set oRng = ActiveDocument.Content
With oRng.Find
'Look for the Heading 2 text on execute
.Style = "Heading 2"
.Wrap = wdFindStop
While .Execute
'Collapse oRng to end of found Heading 2 text
oRng.Collapse wdCollapseEnd
'Set a temporary range that starts at end of Heading 2 text
Set oTempRng = oRng.Duplicate
'Look for Heading 3 text on execute
.Style = "Heading 3"
.Execute
'Collapse oRng to start of Heading 3 text
oRng.Collapse wdCollapseStart
'Define temporary range that ends where Heading 3 text starts
oTempRng.End = oRng.End
'Apply style
oTempRng.Style = "MyStyle"
'Set execute to look for Heading 2 text
.Style = "Heading 2"
Wend
End With
End Sub

Where "MyStyle" is the name of the style you want to apply.


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

Herb Tyson [MVP] wrote:
Not unless there's some unique text in every Heading 2 and Heading 3
heading. Find/Replace lets you find a style, but only one per find.
Hence, you can locate Heading 2 or Heading 3, but not both (and
certainly not with something else sandwiched in-between). Wildcard
searches are really good with text patterns, but limited when it
comes to formatting patterns.
It wouldn't be terribly hard to set up a macro to do it, however.

I have a long document (several thousand pages) that has heads
using Heading Style 1 through Heading Style 5. I would like to
apply a style to the body text between Heading 2 and Heading 3.

Is there a way to set up a Find/Replace to do that for me?

*(((({



  #6  
Old September 20th, 2005, 05:30 AM
external usenet poster
 
Posts: n/a
Default Format between Styles

I love you guys! Thank you. I'll give the macro a try and let you
know how it works. :-)

Happy Fishy
*(((({

 




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
Why report in .snp format is not viewable Ally General Discussion 3 August 17th, 2005 08:45 PM
Displaying and editing Date Time data in a 24hr format scottM General Discussion 2 August 15th, 2005 11:07 PM
Styles in Word 2003 Jessy General Discussion 2 February 1st, 2005 12:49 PM
Delete or disable Styles and Formattings Jae Formatting Long Documents 3 July 26th, 2004 05:53 AM
Change Email Format On Reply or Forward Kevin General Discussion 2 July 15th, 2004 10:47 AM


All times are GMT +1. The time now is 01:30 PM.


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