View Single Post
 
Old 02-16-2021, 04:54 AM
Shelley Lou Shelley Lou is offline Windows 10 Office 2016
Competent Performer
 
Join Date: Dec 2020
Posts: 170
Shelley Lou is on a distinguished road
Default Help with macro - inserting tab

I've run into a problem with a macro I have developed (with help from very kind people on here also). Please see image of before and after the macro is run.
The macro should insert a tab at the beginning of paragraphs that start with (a), (i) (1), a), 1), 100 etc. The macro runs fine except when the paragraph starts with a number. Can anyone help with the code below to insert a tab before a number (please note this is just an extract from the main macro). Thanks, Shelley

Code:
 'insert tab at beginning of paragraph with a bracket e.g. (a), (i), (1)
    With oRng.Find
    .Text = "^p("
    .Replacement.Text = "^p^t("
    .Execute Replace:=wdReplaceAll
  End With
  'insert tab at beginning of paragraph e.g a), 1), i), 100 etc.
    With oRng.Find
    .Text = "[^p]\([a-zA-Z0-9][)]"
    .Replacement.Text = "^p^t"
    .Execute Replace:=wdReplaceAll
  End With
Attached Images
File Type: jpg Definitions (before macro).JPG (94.8 KB, 19 views)
File Type: jpg Definitions (after macro).JPG (102.3 KB, 18 views)
Reply With Quote