View Single Post
 
Old 01-21-2024, 05:26 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I did have a look at your attached docs and can see that you are probably trying to extract info using the html formatting tags as your data type indicators but your methodology is overly complicated.

Using Windows(x) and selections is a quick way to complete chaos which is why I'm not going to suggest an alternative approach.

I recommend you stay in the one document and simply remove anything you don't want. For example, it looks like you don't want any of the hyperlink info so strip that out.
Code:
Sub RemoveLinkTags()
  With ActiveDocument.Range.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "\<a*\>"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchKashida = False
    .MatchDiacritics = False
    .MatchAlefHamza = False
    .MatchControl = False
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = True
    .Execute Replace:=wdReplaceAll
    
    .Text = "</a>"
    .MatchWildcards = False
    .Execute Replace:=wdReplaceAll
  End With
End Sub
Work out how to identify the start and end of chunks that you don't want and strip them out systematically. You can replace with "^t" if you want a tab to replace a chunk you are removing.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote