Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #9  
Old 12-18-2020, 05:30 AM
macropod's Avatar
macropod macropod is offline Macro to delete tabs in Word Windows 10 Macro to delete tabs in Word Office 2010
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

The problem appears to be related to the presence of fields in your content. Try:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "^t"
    .Forward = True
    .Wrap = wdFindStop
  End With
  Do While .Find.Execute = True
    .Start = .Paragraphs(1).Range.Start
    If Len(.Text) - Len(Replace(.Text, vbTab, "")) > 1 Then .Characters.Last.Text = " "
    .Collapse wdCollapseEnd
  Loop
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
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 11:56 PM.


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