Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 12-22-2015, 02:29 PM
gmaxey gmaxey is offline VB for Word - Need macro to loop each line in a document Windows 7 32bit VB for Word - Need macro to loop each line in a document Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,635
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 Greg Maxey
Dim oPar As Paragraph
Dim oRng As Range
  For Each oPar In ActiveDocument.Paragraphs
    If IsNumeric(oPar.Range.Characters(1)) Then
      Set oRng = oPar.Range
      oRng.Collapse wdCollapseStart
      oRng.MoveEndUntil "S", wdForward
      oRng.Delete
    End If
  Next
  Set oRng = ActiveDocument.Range
  oRng.Text = Replace(oRng.Text, vbCr, "")
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 

Tags
loop macro, vb, word 2013 lines



Similar Threads
Thread Thread Starter Forum Replies Last Post
VB for Word - Need macro to loop each line in a document macro to add brackets to each line and add single quotes to each word in the line bracketandquotes Word VBA 17 02-16-2015 03:51 PM
Save As Macro using first line of document as document name redzan Word VBA 1 01-31-2015 09:24 PM
VB for Word - Need macro to loop each line in a document Loop through each Line in Word ilcaa72 Word VBA 4 02-13-2014 11:48 AM
VB for Word - Need macro to loop each line in a document Macro to loop in Word Yamaha Rider Word VBA 2 02-07-2012 05:33 PM
VB for Word - Need macro to loop each line in a document WORD Macro - import picture - resize - position - page break - loop Nano07 Word VBA 2 11-02-2011 05:14 AM

Other Forums: Access Forums

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