R
rnewton01
Hi,
I've got a partial macro that correctly performs the beginning of what I
want but then fails. Here is what I've got:
Sub BlogEq_URL_Formatter()
'
' BlogEq_URL_Formatter Macro
' Macro recorded 1/6/2005 by .
'
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Copy
Selection.EndKey Unit:=wdLine
Selection.TypeParagraph
Selection.Paste
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "\[?*/"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
With Selection
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseStart
Else
.Collapse Direction:=wdCollapseEnd
End If
.Find.Execute Replace:=wdReplaceOne
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseEnd
Else
.Collapse Direction:=wdCollapseStart
End If
.Find.Execute
End With
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "\.?*\]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
With Selection
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseStart
Else
.Collapse Direction:=wdCollapseEnd
End If
.Find.Execute Replace:=wdReplaceOne
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseEnd
Else
.Collapse Direction:=wdCollapseStart
End If
.Find.Execute
End With
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "-"
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine
End Sub
It's supposed to take a list of URLs, one per line, and extract some
information from it and then put that on the next line. It does that fine,
but I need it to repeat until the end of the document.
Right now, it does the first line and then a message pops up asking me if I
want to continue searching the rest of the documnet. If I click no, the macro
stops. If I click yes, the macro finds "-" and replaces with a space.
I need the macro to somehow automatically quit finding "-" and return to the
beginning of the macro and continue on until there are no more URLs in the
document.
The URLs look like this:
[http://mydomain.com/this-page.html]
[http://mydomain.com/this-other-page.html]
And I'm trying to get:
[http://mydomain.com/this-page.html]
this page
[http://mydomain.com/this-other-page.html]
this other page
Any help is greatly appreciated.
Thanks,
Robert
I've got a partial macro that correctly performs the beginning of what I
want but then fails. Here is what I've got:
Sub BlogEq_URL_Formatter()
'
' BlogEq_URL_Formatter Macro
' Macro recorded 1/6/2005 by .
'
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Copy
Selection.EndKey Unit:=wdLine
Selection.TypeParagraph
Selection.Paste
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "\[?*/"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
With Selection
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseStart
Else
.Collapse Direction:=wdCollapseEnd
End If
.Find.Execute Replace:=wdReplaceOne
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseEnd
Else
.Collapse Direction:=wdCollapseStart
End If
.Find.Execute
End With
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "\.?*\]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
With Selection
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseStart
Else
.Collapse Direction:=wdCollapseEnd
End If
.Find.Execute Replace:=wdReplaceOne
If .Find.Forward = True Then
.Collapse Direction:=wdCollapseEnd
Else
.Collapse Direction:=wdCollapseStart
End If
.Find.Execute
End With
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "-"
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine
End Sub
It's supposed to take a list of URLs, one per line, and extract some
information from it and then put that on the next line. It does that fine,
but I need it to repeat until the end of the document.
Right now, it does the first line and then a message pops up asking me if I
want to continue searching the rest of the documnet. If I click no, the macro
stops. If I click yes, the macro finds "-" and replaces with a space.
I need the macro to somehow automatically quit finding "-" and return to the
beginning of the macro and continue on until there are no more URLs in the
document.
The URLs look like this:
[http://mydomain.com/this-page.html]
[http://mydomain.com/this-other-page.html]
And I'm trying to get:
[http://mydomain.com/this-page.html]
this page
[http://mydomain.com/this-other-page.html]
this other page
Any help is greatly appreciated.
Thanks,
Robert