View Single Post
 
Old 11-22-2023, 09:59 AM
gmaxey gmaxey is offline Windows 10 Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,601
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Code:
Sub ScratchMacro()
'A basic Word Macro coded by Gregory K. Maxey
Dim oRng As Range
  Set oRng = ActiveDocument.Paragraphs(1).Range
  'To delete the text of the first paragraph, you don't need find and replace
  If oRng.Text = "Nnnnnnnnnnnn/Nnnnnnnnn" & vbCr Then oRng.Text = vbCr
  Set oRng = ActiveDocument.Range
  'When using .Execute, you don't have to use If .Find.Found = True
  With oRng.Find
    .Text = "Nn Nnn Nnnnn. Nnnn nn NNN Nnnnnnnnn"
    If .Execute Then oRng.Delete
  End With
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote