Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 03-28-2014, 01:04 PM
macropod's Avatar
macropod macropod is offline Need Help Creating Macro Windows 7 32bit Need Help Creating Macro Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Another way:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
  .InsertBefore " "
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchWildcards = True
    .Text = ".([0-9]{1,3}.)"
    .Replacement.Text = ". \1"
    .Execute Replace:=wdReplaceAll
    .Text = " ([a-e].)"
    .Replacement.Text = "^p\1"
    .Execute Replace:=wdReplaceAll
    .Replacement.Style = "Strong"
    .Text = " ([0-9]{1,3}.)"
    .Execute Replace:=wdReplaceAll
  End With
  .Characters.First.Delete
End With
Application.ScreenUpdating = True
End Sub
With the additional 3 lines after '.MatchWildcards = True', it'll handle the questions where the space was missing before the question number.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]

Last edited by macropod; 03-28-2014 at 01:10 PM. Reason: Additional code for malformed question spacing
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help Creating Macro Creating a macro button in powerpoint Sammie0Sue PowerPoint 1 12-06-2013 05:51 AM
Need Help Creating Macro Creating a generic macro? suerose Word 2 07-04-2011 07:59 PM
Need Help Creating Macro Creating macro to convert/print to pdf shabbaranks Word 3 05-18-2011 08:59 AM
Creating a MACRO Nikb3522 Word VBA 0 10-21-2010 05:55 PM
creating macro steveb Word VBA 0 08-14-2010 01:29 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:37 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