Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-28-2017, 11:22 AM
rsrasc rsrasc is offline Need Help With this Macro Windows 10 Need Help With this Macro Office 2013
Competent Performer
Need Help With this Macro
 
Join Date: Mar 2014
Location: Germany
Posts: 148
rsrasc is on a distinguished road
Default Need Help With this Macro

Hi all,

Currently, I'm using the following macro to delete numbers from a document.


Code:
Sub Macro111112()
  With ActiveDocument.Range.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "[0-9]{1,2}"
    .Replacement.Text = "^p"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = True
    .Execute Replace:=wdReplaceAll
  End With
End Sub

Below is a sample of the information in the document.


Start here:

42



The foundation is built on the

43



now this is what is this is this
interesting here

44



ok if you look at age 39 you see formula
at the top

45





the vertebrae one of the segments of the
spinal column there are 33 vertebra and

46

End Here:


Therefore, this macro will delete all the numbers in the document.

My goal is to be able, with your help, to only delete the numbers outside the text. For example, after number 44, you see the following text: "ok if you look at age 39 you see formula at the top".

Basically, I want the macro to delete numbers 42,43,44,45 and 46 but not number 39 or 33, which is within the sentence or line.


Hope this is not confusing.

Thanks!!!
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Spell check macro within macro button field doesn't work in one document samuelle Word VBA 0 07-20-2016 02:27 AM
Macro to add title in header is missing text once macro is run shawnee24 Word VBA 3 05-27-2015 12:35 PM
Need Help With this Macro Macro Question: Need help making a macro to highlight the first word in every sentence LadyAna Word 1 12-06-2014 10:39 PM
Macro Needed to bold specific lines and Macro to turn into CSV anewteacher Word VBA 1 05-28-2014 03:59 PM
custom icon, undo/redo for macro, permanent macro Rapier Excel 0 08-05-2013 06:30 AM

Other Forums: Access Forums

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