Spaces after 1 incorporate footnote

J

Jen

Below is my 1 space after macro, but I need to add 1 space after footnote -
I keep getting errors in my attempts:

..^f<space><space>
to be .^f<space>

a single space after footnote is that possible to do?

Sub Spaces_After()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "([.\?\!]) {1,}"
.Replacement.Text = "\1 "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll

Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = " ^p"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchWholeWord = False
.MatchWildcards = False
End With
Selection.Find.Execute
While Selection.Find.Found
Selection.HomeKey Unit:=wdStory
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.Execute
Wend

Selection.Find.Text = " ^l"
Selection.Find.Replacement.Text = "^l"
Selection.Find.Execute
While Selection.Find.Found
Selection.HomeKey Unit:=wdStory
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.Execute
Wend
End Sub
 
H

Helmut Weber

Hi Jen,
Below is my 1 space after macro, but I need to add 1 space after footnote -
I keep getting errors in my attempts:

at the end of your code,
run that macro.

Sub Scratchmacro()
Dim objFtn As Footnote
For Each objFtn In ActiveDocument.Footnotes
While objFtn.Range.Characters.Last = " "
objFtn.Range.Characters.Last = ""
Wend
objFtn.Range.Characters.Last.Next = " "
Next
End Sub

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
H

Helmut Weber

or do you want to delete several spaces after
the footnote character and have only one space instead?

If so:

Sub ScratchmacroC()
Dim objFtn As Footnote
For Each objFtn In ActiveDocument.Footnotes
While objFtn.Range.Characters.First = " "
objFtn.Range.Characters.First = ""
Wend
Next
End Sub

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
J

Jen

Helmut, help! I just noticed that the first macro 2 spaces to 1 doesn't do
the spaces in the footnotes themselves? Is there any way to do that to? All
storeys?

Sub Spaces_After()
Selection.Find.Clear
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "([.\?\!]) {1,}"
.Replacement.Text = "\1 "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll

Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = " ^p"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchWholeWord = False
.MatchWildcards = False
End With
Selection.Find.Execute
While Selection.Find.Found
Selection.HomeKey Unit:=wdStory
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.Execute
Wend

Selection.Find.Text = " ^l"
Selection.Find.Replacement.Text = "^l"
Selection.Find.Execute
While Selection.Find.Found
Selection.HomeKey Unit:=wdStory
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.Execute
Wend
End Sub


Sub ScratchmacroC()
Dim objFtn As Footnote
For Each objFtn In ActiveDocument.Footnotes
While objFtn.Range.Characters.First = " "
objFtn.Range.Characters.First = ""
Wend
Next
End Sub
 
H

Helmut Weber

Hi Jen,

for spaces following a period, a question mark
or an exclamation mark in a footnote:

Sub Makro3x()
Dim rngFoot As Footnote
Dim rngTmp As Range
For Each rngFoot In ActiveDocument.Footnotes
Set rngTmp = rngFoot.Range
With rngTmp.Find
.Text = "([.\?\!]) {1,}"
.Replacement.Text = "\1 " ' note the space here
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
Next
End Sub

For spaces following the footnote character (the number),
see the macro "ScratchmacroC" I gave you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top