Author Topic: Copy/paste wikipedia text comes up with reference numbers, [edit]? Use this Word macro to clean up.  (Read 1012 times)

spiros

  • Administrator
  • Hero Member
  • *****
  • Posts: 289883
  • Gender: Male
  • point d’amour
    • spiros.doikas
    • 102094522373850556729
    • doikas
    • greektranslator
    • lavagraph
    • Greek translator CV
Copy/paste wikipedia text comes up with reference numbers, [edit]? Use this Word macro to clean up.

I created a macro that will delete unnecessary text like [1], [edit], [citation needed] when pasting text from wikipedia. The macro does the trick for English and Greek wikipedia. Feel free to add your own language bits.


Code: [Select]
Sub cleanwikipedia()
'
' wikipedia clean up references Macro
' Macro by Spiros Doikas - see https://www.translatum.gr/forum/index.php?topic=171118.0
'
With Selection.Find
  .Text = "[citation needed]"
  .Replacement.Text = ""
  .Forward = True
  .Wrap = wdFindContinue
  .MatchCase = False
  .MatchWholeWord = False
  .MatchWildcards = False
  .MatchSoundsLike = False
  .MatchAllWordForms = False
  .Execute Replace:=wdReplaceAll
  .Text = "[^#]"
  .Replacement.Text = ""
  .MatchWholeWord = False
  .Execute Replace:=wdReplaceAll
  .Text = "[^#^#]"
  .Replacement.Text = ""
  .MatchWholeWord = False
  .Execute Replace:=wdReplaceAll
  .Text = "[edit]"
  .Replacement.Text = ""
  .MatchWholeWord = False
  .Execute Replace:=wdReplaceAll
  .Text = "[Επεξεργασία]"
  .Replacement.Text = ""
  .MatchWholeWord = False
  .Execute Replace:=wdReplaceAll
  .Text = "[εκκρεμεί παραπομπή]"
  .Replacement.Text = ""
  .MatchWholeWord = False
  .Execute Replace:=wdReplaceAll

  End With
    
  End Sub

See also: How to install a macro in Word
« Last Edit: 17 Jun, 2011, 16:55:05 by spiros »