F
Francis Hookham
As an administrator I have to make changes to a website page. For reasons I
do not understand, on saving, the links in the page default to the Home
page, rather than to the intended links within the page.
The solution is to remove "?ide=###" from the HTML, where ### is the three
digit page ID.
I can do this by copying HTML into Word and simply finding "?ide=" in order
to see what is the three digit number. Then, using that information, replace
it with "".
It would be great to automate this as much as possible so I recorded the
macro below. The problem is that it is specific, having recorded that
particular page, "?ide=360"
How can the macro pick up any page number? I suppose what I am asking is,
after the Find, how can the next three characters be selected and the whole
"?ide=###" be selected irrespective of what the ### is?
(A deeper question might be to wonder about four characters since the fourth
is a hash suggesting the website can cope with 9,999 pages rather than 999
pages. So a macro which senses the whether the fourth character as a hash or
not and replacing accordingly might be necessary in a year or two! Any
thoughts on that at this stage?)
Many thanks
Francis Hookham
Sub ideRemoval()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "?ide="
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCharacter, Count:=3, Extend:=wdExtend
Selection.Copy
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "?ide=360"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.WholeStory
Selection.Copy
End Sub
do not understand, on saving, the links in the page default to the Home
page, rather than to the intended links within the page.
The solution is to remove "?ide=###" from the HTML, where ### is the three
digit page ID.
I can do this by copying HTML into Word and simply finding "?ide=" in order
to see what is the three digit number. Then, using that information, replace
it with "".
It would be great to automate this as much as possible so I recorded the
macro below. The problem is that it is specific, having recorded that
particular page, "?ide=360"
How can the macro pick up any page number? I suppose what I am asking is,
after the Find, how can the next three characters be selected and the whole
"?ide=###" be selected irrespective of what the ### is?
(A deeper question might be to wonder about four characters since the fourth
is a hash suggesting the website can cope with 9,999 pages rather than 999
pages. So a macro which senses the whether the fourth character as a hash or
not and replacing accordingly might be necessary in a year or two! Any
thoughts on that at this stage?)
Many thanks
Francis Hookham
Sub ideRemoval()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "?ide="
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCharacter, Count:=3, Extend:=wdExtend
Selection.Copy
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "?ide=360"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.WholeStory
Selection.Copy
End Sub