Skip to content

Instantly share code, notes, and snippets.

@darkxanter
Created February 16, 2018 18:51
Show Gist options
  • Save darkxanter/dafe43e1041bd571761e8841a22885f9 to your computer and use it in GitHub Desktop.
Save darkxanter/dafe43e1041bd571761e8841a22885f9 to your computer and use it in GitHub Desktop.
Sub RefNoText()
'Подавить постоянную часть перекрестной и оставить
'только номер вставкой ключа числового формата в поле Ref
With Selection
.Fields.ToggleShowCodes
.Find.ClearFormatting
.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "_Ref^#^#^#^#^#^#^#^#^#"
.Replacement.Text = "^& \# 0"
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
.Find.Execute Replace:=wdReplaceAll
.Fields.Update
End With
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment