spiros

  • Administrator
  • Hero Member
  • *****
    • Posts: 858881
    • Gender:Male
  • point d’amour
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 »
Look up Multiple Greek, Ancient Greek and Latin dictionaries — Οὕτω τι βαθὺ καὶ μυστηριῶδες ἡ σιγὴ καὶ νηφάλιον, ἡ δὲ μέθη λάλον· ἄνουν γὰρ καὶ ὀλιγόφρον, διὰ τοῦτο καὶ πολύφωνον (Plutarch)


 

Search Tools