Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-16-2021, 04:54 AM
Shelley Lou Shelley Lou is offline Help with macro - inserting tab Windows 10 Help with macro - inserting tab Office 2016
Expert
Help with macro - inserting tab
 
Join Date: Dec 2020
Posts: 259
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, 22 views)
File Type: jpg Definitions (after macro).JPG (102.3 KB, 21 views)
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with macro - inserting tab Is it possible to make a macro for inserting a 'division box?' Rayroshi Word 1 08-30-2018 06:40 PM
Macro-inserting text box BLUEPUPIL Word VBA 14 04-16-2018 06:59 AM
Help with macro - inserting tab Macro for inserting and formatting headers and footers Mike_Lennox Word VBA 4 10-06-2016 12:10 AM
Help with macro - inserting tab Need Macro for Find and Replace, Inserting logo in Ms-Word. Aswinraj Word VBA 1 06-05-2016 04:33 PM
Help with macro - inserting tab Inserting key strokes with a macro line ACA Word VBA 4 12-03-2012 04:40 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:20 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft