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 create style to automatically suppress CR after a Heading?



 
 
Thread Tools Display Modes
  #1  
Old August 12th, 2006, 08:03 PM posted to microsoft.public.word.pagelayout
MarkLTaper
external usenet poster
 
Posts: 5
Default How to create style to automatically suppress CR after a Heading?

I am trying to create a heading style so that following text begins on the
same line, but I am baffled. I see no way to suppress the carriage return.
Jay Freedman's response to my previous question showed how to manually
format to create the proper effect on a case by case basis not how to set up
a style.
I use this format frequently so I would like to have it automatic, if
possible.

Thanks MLT

I want:

Heading 4: Following text

not

Heading 4:
Following text

  #2  
Old August 12th, 2006, 11:33 PM posted to microsoft.public.word.pagelayout
Jay Freedman
external usenet poster
 
Posts: 9,488
Default How to create style to automatically suppress CR after a Heading?

OK, I see what you're trying to do. It will be possible with a macro
-- more likely, a series of macros -- that do all the formatting. You
can assign each macro to a toolbar button, a shortcut key, or both.

An example macro is shown below. This is specific for the situation
you showed; if you want other heading styles, or other assumptions
about the starting selection, you'd need other macros for those.

This example assumes that you've already typed the text of both the
heading and at least part of the following text, all in the regular
body style in a single paragraph, and that you've selected the part
you want to make into a Heading 4. It doesn't work right if you select
an entire paragraph.

Sub ApplyRunin4()
' the selected text will take Heading 4 style
' with a hidden paragraph mark at the end

If Selection.Type wdSelectionNormal Then
MsgBox "Please select the heading text first."
Exit Sub
End If

If Selection.Start Selection.Paragraphs(1).Range.Start Then
MsgBox "Please select text at the beginning of the paragraph."
Exit Sub
End If

With Selection
.InsertParagraphAfter
.Collapse wdCollapseStart
.Style = ActiveDocument.Styles("Heading 4")
.Paragraphs(1).Range.Select
.Collapse wdCollapseEnd
.MoveStart wdCharacter, -1
.Font.Hidden = True
End With
End Sub

For help with installing the macro and assigning it to a button and/or
shortcut, see these articles:

http://www.gmayor.com/installing_macro.htm
http://www.word.mvps.org/FAQs/Custom...oToToolbar.htm
http://www.word.mvps.org/FAQs/Custom...roToHotkey.htm

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sat, 12 Aug 2006 12:03:02 -0700, MarkLTaper
wrote:

I am trying to create a heading style so that following text begins on the
same line, but I am baffled. I see no way to suppress the carriage return.
Jay Freedman's response to my previous question showed how to manually
format to create the proper effect on a case by case basis not how to set up
a style.
I use this format frequently so I would like to have it automatic, if
possible.

Thanks MLT

I want:

Heading 4: Following text

not

Heading 4:
Following text

  #3  
Old August 12th, 2006, 11:57 PM posted to microsoft.public.word.pagelayout
MarkLTaper
external usenet poster
 
Posts: 5
Default How to create style to automatically suppress CR after a Headi

Jay, This is great. I can see that macros open up a vast flexibility. I
will work on implimenting this macro. However, I am thinking that for my
purposes, a macro that searchs for every level 4 heading goes to its end and
hides the CR would be most effective. Are their subtle enough search
functions in the macro language to make this approach work? If you think so
then I will try to work this out.

Thanks again

"Jay Freedman" wrote:

OK, I see what you're trying to do. It will be possible with a macro
-- more likely, a series of macros -- that do all the formatting. You
can assign each macro to a toolbar button, a shortcut key, or both.

An example macro is shown below. This is specific for the situation
you showed; if you want other heading styles, or other assumptions
about the starting selection, you'd need other macros for those.

This example assumes that you've already typed the text of both the
heading and at least part of the following text, all in the regular
body style in a single paragraph, and that you've selected the part
you want to make into a Heading 4. It doesn't work right if you select
an entire paragraph.

Sub ApplyRunin4()
' the selected text will take Heading 4 style
' with a hidden paragraph mark at the end

If Selection.Type wdSelectionNormal Then
MsgBox "Please select the heading text first."
Exit Sub
End If

If Selection.Start Selection.Paragraphs(1).Range.Start Then
MsgBox "Please select text at the beginning of the paragraph."
Exit Sub
End If

With Selection
.InsertParagraphAfter
.Collapse wdCollapseStart
.Style = ActiveDocument.Styles("Heading 4")
.Paragraphs(1).Range.Select
.Collapse wdCollapseEnd
.MoveStart wdCharacter, -1
.Font.Hidden = True
End With
End Sub

For help with installing the macro and assigning it to a button and/or
shortcut, see these articles:

http://www.gmayor.com/installing_macro.htm
http://www.word.mvps.org/FAQs/Custom...oToToolbar.htm
http://www.word.mvps.org/FAQs/Custom...roToHotkey.htm

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sat, 12 Aug 2006 12:03:02 -0700, MarkLTaper
wrote:

I am trying to create a heading style so that following text begins on the
same line, but I am baffled. I see no way to suppress the carriage return.
Jay Freedman's response to my previous question showed how to manually
format to create the proper effect on a case by case basis not how to set up
a style.
I use this format frequently so I would like to have it automatic, if
possible.

Thanks MLT

I want:

Heading 4: Following text

not

Heading 4:
Following text


  #4  
Old August 13th, 2006, 01:07 AM posted to microsoft.public.word.pagelayout
Jay Freedman
external usenet poster
 
Posts: 9,488
Default How to create style to automatically suppress CR after a Headi

Hi Mark,

Ask and ye shall receive....

Sub RuninAllHeading4()
Dim SearchRg As Range
Dim HideRg As Range
Set SearchRg = ActiveDocument.Range
With SearchRg.Find
.ClearFormatting
.Text = ""
.Style = wdStyleHeading4
.Format = True
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = False
Do While .Execute
Set HideRg = SearchRg.Duplicate
With HideRg
.Collapse wdCollapseEnd
.MoveStartWhile cset:=Chr(13), Count:=wdBackward
.Font.Hidden = True
End With

With SearchRg
.Collapse wdCollapseEnd
.MoveEnd unit:=wdCharacter, Count:=1
.Select
If (.Text " ") And (.Text Chr$(9)) Then
.InsertBefore " "
End If
.Collapse wdCollapseEnd
End With
Loop
End With
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sat, 12 Aug 2006 15:57:01 -0700, MarkLTaper
wrote:

Jay, This is great. I can see that macros open up a vast flexibility. I
will work on implimenting this macro. However, I am thinking that for my
purposes, a macro that searchs for every level 4 heading goes to its end and
hides the CR would be most effective. Are their subtle enough search
functions in the macro language to make this approach work? If you think so
then I will try to work this out.

Thanks again

"Jay Freedman" wrote:

OK, I see what you're trying to do. It will be possible with a macro
-- more likely, a series of macros -- that do all the formatting. You
can assign each macro to a toolbar button, a shortcut key, or both.

An example macro is shown below. This is specific for the situation
you showed; if you want other heading styles, or other assumptions
about the starting selection, you'd need other macros for those.

This example assumes that you've already typed the text of both the
heading and at least part of the following text, all in the regular
body style in a single paragraph, and that you've selected the part
you want to make into a Heading 4. It doesn't work right if you select
an entire paragraph.

Sub ApplyRunin4()
' the selected text will take Heading 4 style
' with a hidden paragraph mark at the end

If Selection.Type wdSelectionNormal Then
MsgBox "Please select the heading text first."
Exit Sub
End If

If Selection.Start Selection.Paragraphs(1).Range.Start Then
MsgBox "Please select text at the beginning of the paragraph."
Exit Sub
End If

With Selection
.InsertParagraphAfter
.Collapse wdCollapseStart
.Style = ActiveDocument.Styles("Heading 4")
.Paragraphs(1).Range.Select
.Collapse wdCollapseEnd
.MoveStart wdCharacter, -1
.Font.Hidden = True
End With
End Sub

For help with installing the macro and assigning it to a button and/or
shortcut, see these articles:

http://www.gmayor.com/installing_macro.htm
http://www.word.mvps.org/FAQs/Custom...oToToolbar.htm
http://www.word.mvps.org/FAQs/Custom...roToHotkey.htm

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sat, 12 Aug 2006 12:03:02 -0700, MarkLTaper
wrote:

I am trying to create a heading style so that following text begins on the
same line, but I am baffled. I see no way to suppress the carriage return.
Jay Freedman's response to my previous question showed how to manually
format to create the proper effect on a case by case basis not how to set up
a style.
I use this format frequently so I would like to have it automatic, if
possible.

Thanks MLT

I want:

Heading 4: Following text

not

Heading 4:
Following text


  #5  
Old August 13th, 2006, 01:18 AM posted to microsoft.public.word.pagelayout
MarkLTaper
external usenet poster
 
Posts: 5
Default How to create style to automatically suppress CR after a Headi

Well I didn't want to ask because that would have been greedy. This is
perfect, and I doubt I could have constructed it myself.

Thanks MarkLTaper

"Jay Freedman" wrote:

Hi Mark,

Ask and ye shall receive....

Sub RuninAllHeading4()
Dim SearchRg As Range
Dim HideRg As Range
Set SearchRg = ActiveDocument.Range
With SearchRg.Find
.ClearFormatting
.Text = ""
.Style = wdStyleHeading4
.Format = True
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = False
Do While .Execute
Set HideRg = SearchRg.Duplicate
With HideRg
.Collapse wdCollapseEnd
.MoveStartWhile cset:=Chr(13), Count:=wdBackward
.Font.Hidden = True
End With

With SearchRg
.Collapse wdCollapseEnd
.MoveEnd unit:=wdCharacter, Count:=1
.Select
If (.Text " ") And (.Text Chr$(9)) Then
.InsertBefore " "
End If
.Collapse wdCollapseEnd
End With
Loop
End With
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sat, 12 Aug 2006 15:57:01 -0700, MarkLTaper
wrote:

Jay, This is great. I can see that macros open up a vast flexibility. I
will work on implimenting this macro. However, I am thinking that for my
purposes, a macro that searchs for every level 4 heading goes to its end and
hides the CR would be most effective. Are their subtle enough search
functions in the macro language to make this approach work? If you think so
then I will try to work this out.

Thanks again

"Jay Freedman" wrote:

OK, I see what you're trying to do. It will be possible with a macro
-- more likely, a series of macros -- that do all the formatting. You
can assign each macro to a toolbar button, a shortcut key, or both.

An example macro is shown below. This is specific for the situation
you showed; if you want other heading styles, or other assumptions
about the starting selection, you'd need other macros for those.

This example assumes that you've already typed the text of both the
heading and at least part of the following text, all in the regular
body style in a single paragraph, and that you've selected the part
you want to make into a Heading 4. It doesn't work right if you select
an entire paragraph.

Sub ApplyRunin4()
' the selected text will take Heading 4 style
' with a hidden paragraph mark at the end

If Selection.Type wdSelectionNormal Then
MsgBox "Please select the heading text first."
Exit Sub
End If

If Selection.Start Selection.Paragraphs(1).Range.Start Then
MsgBox "Please select text at the beginning of the paragraph."
Exit Sub
End If

With Selection
.InsertParagraphAfter
.Collapse wdCollapseStart
.Style = ActiveDocument.Styles("Heading 4")
.Paragraphs(1).Range.Select
.Collapse wdCollapseEnd
.MoveStart wdCharacter, -1
.Font.Hidden = True
End With
End Sub

For help with installing the macro and assigning it to a button and/or
shortcut, see these articles:

http://www.gmayor.com/installing_macro.htm
http://www.word.mvps.org/FAQs/Custom...oToToolbar.htm
http://www.word.mvps.org/FAQs/Custom...roToHotkey.htm

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sat, 12 Aug 2006 12:03:02 -0700, MarkLTaper
wrote:

I am trying to create a heading style so that following text begins on the
same line, but I am baffled. I see no way to suppress the carriage return.
Jay Freedman's response to my previous question showed how to manually
format to create the proper effect on a case by case basis not how to set up
a style.
I use this format frequently so I would like to have it automatic, if
possible.

Thanks MLT

I want:

Heading 4: Following text

not

Heading 4:
Following text


  #6  
Old August 13th, 2006, 01:33 PM posted to microsoft.public.word.pagelayout
Jay Freedman
external usenet poster
 
Posts: 9,488
Default How to create style to automatically suppress CR after a Headi

You're welcome.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sat, 12 Aug 2006 17:18:01 -0700, MarkLTaper
wrote:

Well I didn't want to ask because that would have been greedy. This is
perfect, and I doubt I could have constructed it myself.

Thanks MarkLTaper

"Jay Freedman" wrote:

Hi Mark,

Ask and ye shall receive....

Sub RuninAllHeading4()
Dim SearchRg As Range
Dim HideRg As Range
Set SearchRg = ActiveDocument.Range
With SearchRg.Find
.ClearFormatting
.Text = ""
.Style = wdStyleHeading4
.Format = True
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = False
Do While .Execute
Set HideRg = SearchRg.Duplicate
With HideRg
.Collapse wdCollapseEnd
.MoveStartWhile cset:=Chr(13), Count:=wdBackward
.Font.Hidden = True
End With

With SearchRg
.Collapse wdCollapseEnd
.MoveEnd unit:=wdCharacter, Count:=1
.Select
If (.Text " ") And (.Text Chr$(9)) Then
.InsertBefore " "
End If
.Collapse wdCollapseEnd
End With
Loop
End With
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sat, 12 Aug 2006 15:57:01 -0700, MarkLTaper
wrote:

Jay, This is great. I can see that macros open up a vast flexibility. I
will work on implimenting this macro. However, I am thinking that for my
purposes, a macro that searchs for every level 4 heading goes to its end and
hides the CR would be most effective. Are their subtle enough search
functions in the macro language to make this approach work? If you think so
then I will try to work this out.

Thanks again

"Jay Freedman" wrote:

OK, I see what you're trying to do. It will be possible with a macro
-- more likely, a series of macros -- that do all the formatting. You
can assign each macro to a toolbar button, a shortcut key, or both.

An example macro is shown below. This is specific for the situation
you showed; if you want other heading styles, or other assumptions
about the starting selection, you'd need other macros for those.

This example assumes that you've already typed the text of both the
heading and at least part of the following text, all in the regular
body style in a single paragraph, and that you've selected the part
you want to make into a Heading 4. It doesn't work right if you select
an entire paragraph.

Sub ApplyRunin4()
' the selected text will take Heading 4 style
' with a hidden paragraph mark at the end

If Selection.Type wdSelectionNormal Then
MsgBox "Please select the heading text first."
Exit Sub
End If

If Selection.Start Selection.Paragraphs(1).Range.Start Then
MsgBox "Please select text at the beginning of the paragraph."
Exit Sub
End If

With Selection
.InsertParagraphAfter
.Collapse wdCollapseStart
.Style = ActiveDocument.Styles("Heading 4")
.Paragraphs(1).Range.Select
.Collapse wdCollapseEnd
.MoveStart wdCharacter, -1
.Font.Hidden = True
End With
End Sub

For help with installing the macro and assigning it to a button and/or
shortcut, see these articles:

http://www.gmayor.com/installing_macro.htm
http://www.word.mvps.org/FAQs/Custom...oToToolbar.htm
http://www.word.mvps.org/FAQs/Custom...roToHotkey.htm

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sat, 12 Aug 2006 12:03:02 -0700, MarkLTaper
wrote:

I am trying to create a heading style so that following text begins on the
same line, but I am baffled. I see no way to suppress the carriage return.
Jay Freedman's response to my previous question showed how to manually
format to create the proper effect on a case by case basis not how to set up
a style.
I use this format frequently so I would like to have it automatic, if
possible.

Thanks MLT

I want:

Heading 4: Following text

not

Heading 4:
Following text


  #7  
Old May 11th, 2010, 04:11 PM posted to microsoft.public.word.pagelayout
Dan Hart
external usenet poster
 
Posts: 1
Default How to create style to automatically suppress CR after a Headi

Is a macro still the only option for creating a heading with no CR/LF? Any
updates on this answer?

"Jay Freedman" wrote:

You're welcome.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sat, 12 Aug 2006 17:18:01 -0700, MarkLTaper
wrote:

Well I didn't want to ask because that would have been greedy. This is
perfect, and I doubt I could have constructed it myself.

Thanks MarkLTaper

"Jay Freedman" wrote:

Hi Mark,

Ask and ye shall receive....

Sub RuninAllHeading4()
Dim SearchRg As Range
Dim HideRg As Range
Set SearchRg = ActiveDocument.Range
With SearchRg.Find
.ClearFormatting
.Text = ""
.Style = wdStyleHeading4
.Format = True
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = False
Do While .Execute
Set HideRg = SearchRg.Duplicate
With HideRg
.Collapse wdCollapseEnd
.MoveStartWhile cset:=Chr(13), Count:=wdBackward
.Font.Hidden = True
End With

With SearchRg
.Collapse wdCollapseEnd
.MoveEnd unit:=wdCharacter, Count:=1
.Select
If (.Text " ") And (.Text Chr$(9)) Then
.InsertBefore " "
End If
.Collapse wdCollapseEnd
End With
Loop
End With
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sat, 12 Aug 2006 15:57:01 -0700, MarkLTaper
wrote:

Jay, This is great. I can see that macros open up a vast flexibility. I
will work on implimenting this macro. However, I am thinking that for my
purposes, a macro that searchs for every level 4 heading goes to its end and
hides the CR would be most effective. Are their subtle enough search
functions in the macro language to make this approach work? If you think so
then I will try to work this out.

Thanks again

"Jay Freedman" wrote:

OK, I see what you're trying to do. It will be possible with a macro
-- more likely, a series of macros -- that do all the formatting. You
can assign each macro to a toolbar button, a shortcut key, or both.

An example macro is shown below. This is specific for the situation
you showed; if you want other heading styles, or other assumptions
about the starting selection, you'd need other macros for those.

This example assumes that you've already typed the text of both the
heading and at least part of the following text, all in the regular
body style in a single paragraph, and that you've selected the part
you want to make into a Heading 4. It doesn't work right if you select
an entire paragraph.

Sub ApplyRunin4()
' the selected text will take Heading 4 style
' with a hidden paragraph mark at the end

If Selection.Type wdSelectionNormal Then
MsgBox "Please select the heading text first."
Exit Sub
End If

If Selection.Start Selection.Paragraphs(1).Range.Start Then
MsgBox "Please select text at the beginning of the paragraph."
Exit Sub
End If

With Selection
.InsertParagraphAfter
.Collapse wdCollapseStart
.Style = ActiveDocument.Styles("Heading 4")
.Paragraphs(1).Range.Select
.Collapse wdCollapseEnd
.MoveStart wdCharacter, -1
.Font.Hidden = True
End With
End Sub

For help with installing the macro and assigning it to a button and/or
shortcut, see these articles:

http://www.gmayor.com/installing_macro.htm
http://www.word.mvps.org/FAQs/Custom...oToToolbar.htm
http://www.word.mvps.org/FAQs/Custom...roToHotkey.htm

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sat, 12 Aug 2006 12:03:02 -0700, MarkLTaper
wrote:

I am trying to create a heading style so that following text begins on the
same line, but I am baffled. I see no way to suppress the carriage return.
Jay Freedman's response to my previous question showed how to manually
format to create the proper effect on a case by case basis not how to set up
a style.
I use this format frequently so I would like to have it automatic, if
possible.

Thanks MLT

I want:

Heading 4: Following text

not

Heading 4:
Following text



  #8  
Old May 11th, 2010, 04:34 PM posted to microsoft.public.word.pagelayout
DeanH
external usenet poster
 
Posts: 1,783
Default How to create style to automatically suppress CR after a Headi

There is no way of creating a Heading with out a paragraph mark because these
are by definition a paragraph style BUT you can by using the Style Separator
to combine the Heading and the following text. And only the "Heading" text
will show in the Table of Contents if that is something that you require.

Alt+Ctrl+Return or InsertStyleSeparator icon in the Commands listing.

Hope this helps
DeanH


"Dan Hart" wrote:

Is a macro still the only option for creating a heading with no CR/LF? Any
updates on this answer?

"Jay Freedman" wrote:

You're welcome.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sat, 12 Aug 2006 17:18:01 -0700, MarkLTaper
wrote:

Well I didn't want to ask because that would have been greedy. This is
perfect, and I doubt I could have constructed it myself.

Thanks MarkLTaper

"Jay Freedman" wrote:

Hi Mark,

Ask and ye shall receive....

Sub RuninAllHeading4()
Dim SearchRg As Range
Dim HideRg As Range
Set SearchRg = ActiveDocument.Range
With SearchRg.Find
.ClearFormatting
.Text = ""
.Style = wdStyleHeading4
.Format = True
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = False
Do While .Execute
Set HideRg = SearchRg.Duplicate
With HideRg
.Collapse wdCollapseEnd
.MoveStartWhile cset:=Chr(13), Count:=wdBackward
.Font.Hidden = True
End With

With SearchRg
.Collapse wdCollapseEnd
.MoveEnd unit:=wdCharacter, Count:=1
.Select
If (.Text " ") And (.Text Chr$(9)) Then
.InsertBefore " "
End If
.Collapse wdCollapseEnd
End With
Loop
End With
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sat, 12 Aug 2006 15:57:01 -0700, MarkLTaper
wrote:

Jay, This is great. I can see that macros open up a vast flexibility. I
will work on implimenting this macro. However, I am thinking that for my
purposes, a macro that searchs for every level 4 heading goes to its end and
hides the CR would be most effective. Are their subtle enough search
functions in the macro language to make this approach work? If you think so
then I will try to work this out.

Thanks again

"Jay Freedman" wrote:

OK, I see what you're trying to do. It will be possible with a macro
-- more likely, a series of macros -- that do all the formatting. You
can assign each macro to a toolbar button, a shortcut key, or both.

An example macro is shown below. This is specific for the situation
you showed; if you want other heading styles, or other assumptions
about the starting selection, you'd need other macros for those.

This example assumes that you've already typed the text of both the
heading and at least part of the following text, all in the regular
body style in a single paragraph, and that you've selected the part
you want to make into a Heading 4. It doesn't work right if you select
an entire paragraph.

Sub ApplyRunin4()
' the selected text will take Heading 4 style
' with a hidden paragraph mark at the end

If Selection.Type wdSelectionNormal Then
MsgBox "Please select the heading text first."
Exit Sub
End If

If Selection.Start Selection.Paragraphs(1).Range.Start Then
MsgBox "Please select text at the beginning of the paragraph."
Exit Sub
End If

With Selection
.InsertParagraphAfter
.Collapse wdCollapseStart
.Style = ActiveDocument.Styles("Heading 4")
.Paragraphs(1).Range.Select
.Collapse wdCollapseEnd
.MoveStart wdCharacter, -1
.Font.Hidden = True
End With
End Sub

For help with installing the macro and assigning it to a button and/or
shortcut, see these articles:

http://www.gmayor.com/installing_macro.htm
http://www.word.mvps.org/FAQs/Custom...oToToolbar.htm
http://www.word.mvps.org/FAQs/Custom...roToHotkey.htm

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sat, 12 Aug 2006 12:03:02 -0700, MarkLTaper
wrote:

I am trying to create a heading style so that following text begins on the
same line, but I am baffled. I see no way to suppress the carriage return.
Jay Freedman's response to my previous question showed how to manually
format to create the proper effect on a case by case basis not how to set up
a style.
I use this format frequently so I would like to have it automatic, if
possible.

Thanks MLT

I want:

Heading 4: Following text

not

Heading 4:
Following text



 




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 01:03 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.