Reply
 
Thread Tools Display Modes
  #1   Report Post  
Paresh
 
Posts: n/a
Default To insert 2 spaces after full stop or end of sentence or paragraph

Can any one give me macro syntax to do the following:

1. To insert 2 spaces after every full stop or end of sentence or end of
paragraph(just before para return sign)

2. The above should work for text in Tables also.

Thanks in advance.


  #2   Report Post  
Greg
 
Posts: n/a
Default

Try something like:

Public Sub Scratch Macro()

Dim rngStory As Word.Range
' Fix the skipped blank Header/Footer problem
MakeHFValid
' Iterate through all story types in the current document
For Each rngStory In ActiveDocument.StoryRanges
' Iterate through all linked stories
Do Until (rngStory Is Nothing)
With rngStory.Find
.ClearFormatting
.Replacement.ClearFormatting
.MatchWildcards = True
.Text = "([:.,\!\?]) ([! ])":
.Replacement.Text = "\1 \2"
.Execute Replace:=wdReplaceAll
End With
Set rngStory = rngStory.NextStoryRange
Loop
Next
End Sub
Public Sub MakeHFValid()
Dim lngJunk As Long
lngJunk = ActiveDocument.Sections(1).Headers(1).Range.StoryT ype
End Sub

  #3   Report Post  
Paresh
 
Posts: n/a
Default

Greg:

Thanks once again! But this macro does not help me in end of paragraph
returns.

Regards
Paresh

"Greg" wrote:

Try something like:

Public Sub Scratch Macro()

Dim rngStory As Word.Range
' Fix the skipped blank Header/Footer problem
MakeHFValid
' Iterate through all story types in the current document
For Each rngStory In ActiveDocument.StoryRanges
' Iterate through all linked stories
Do Until (rngStory Is Nothing)
With rngStory.Find
.ClearFormatting
.Replacement.ClearFormatting
.MatchWildcards = True
.Text = "([:.,\!\?]) ([! ])":
.Replacement.Text = "\1 \2"
.Execute Replace:=wdReplaceAll
End With
Set rngStory = rngStory.NextStoryRange
Loop
Next
End Sub
Public Sub MakeHFValid()
Dim lngJunk As Long
lngJunk = ActiveDocument.Sections(1).Headers(1).Range.StoryT ype
End Sub


  #4   Report Post  
Greg
 
Posts: n/a
Default

Not sure I follow, but try:

Option Explicit
Public Sub ScratchMacro()

Dim rngStory As Word.Range
' Fix the skipped blank Header/Footer problem
MakeHFValid
' Iterate through all story types in the current document
For Each rngStory In ActiveDocument.StoryRanges
' Iterate through all linked stories
Do Until (rngStory Is Nothing)
With rngStory.Find
.ClearFormatting
.Replacement.ClearFormatting
.MatchWildcards = True
.Text = "([:.,\!\?\^13]) ([! ])":
.Replacement.Text = "\1 \2"
.Execute Replace:=wdReplaceAll
.Text = "(?)(^13)"
.Replacement.Text = "\1 \2"
.Execute Replace:=wdReplaceAll
End With
Set rngStory = rngStory.NextStoryRange
Loop
Next
End Sub
Public Sub MakeHFValid()
Dim lngJunk As Long
lngJunk = ActiveDocument.Sections(1).Headers(1).Range.StoryT ype
End Sub

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
How do I display the full filepath on insert hyperlink in Word 200 Frustrated from London Microsoft Word Help 5 March 7th 06 10:10 PM
Can I stop a picture from being copied after insert it into a Word jshumzzz Microsoft Word Help 1 July 14th 05 09:08 PM
How do I get Word to stop putting extra spaces after a period whe. Wants a Manual I Can Hold In My Hand! Microsoft Word Help 2 February 2nd 05 12:27 AM
when I Insert...Object in Word, want filename to exclude full pat. Christopher Gilliatt Microsoft Word Help 1 January 20th 05 09:41 PM
insert spaces dk Page Layout 4 December 7th 04 08:54 AM


All times are GMT +1. The time now is 04:52 AM.

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

About Us

"It's about Microsoft Word"