Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 12-16-2020, 04:07 PM
gmaxey gmaxey is offline Macro to delete tabs in Word Windows 10 Macro to delete tabs in Word Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,636
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Paul's method will work and be very fast for the specific example you gave. If you want a macro that simply deletes all but the first tab in each paragraph of text, you could use:


Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oPar As Paragraph
Dim oRng As Range
Dim lngIndex As Long
  For Each oPar In ActiveDocument.Range.Paragraphs
    lngIndex = 0
    Set oRng = oPar.Range
    With oRng.Find
      .Text = Chr(9)
      While .Execute
        oRng.Select
        lngIndex = lngIndex + 1
        If lngIndex > 1 Then
          oRng.Text = " "
          oRng.Collapse wdCollapseEnd
        End If
      Wend
    End With
  Next oPar
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to delete tabs in Word I need a macro to format images and remove tabs. help LuisXVI Word VBA 4 11-12-2018 03:12 PM
Macro to delete tabs in Word Macro to delete pages in Word 2007 staicumihai Word VBA 4 11-07-2018 01:14 AM
Macro to delete tabs in Word Need Word Macro to Delete Text rsrasc Word VBA 4 04-18-2018 11:32 PM
Tabs set along left edge of page; how to delete ginny Word 4 03-21-2018 08:07 PM
Macro to delete tabs in Word Word Macro to find and delete rows that contain adjacent cells containing "." AlexanderJohnWilley Word VBA 7 11-08-2012 10:15 AM

Other Forums: Access Forums

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