Warning: Trying to access array offset on value of type bool in /home/xtina102050/public_html/wp-content/themes/Divi/includes/builder/functions.php on line 2494
How do I remove horizontal tabs from Word documents with VBA?

Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/xtina102050/public_html/wp-content/themes/Divi/includes/builder/class-et-builder-element.php on line 12385

Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/xtina102050/public_html/wp-content/themes/Divi/includes/builder/class-et-builder-element.php on line 12385

Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/xtina102050/public_html/wp-content/themes/Divi/includes/builder/class-et-builder-element.php on line 12385

Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/xtina102050/public_html/wp-content/themes/Divi/includes/builder/class-et-builder-element.php on line 12385

Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/xtina102050/public_html/wp-content/themes/Divi/includes/builder/class-et-builder-element.php on line 12385

Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/xtina102050/public_html/wp-content/themes/Divi/includes/builder/class-et-builder-element.php on line 12385

Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/xtina102050/public_html/wp-content/themes/Divi/includes/builder/class-et-builder-element.php on line 12385

Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/xtina102050/public_html/wp-content/themes/Divi/includes/builder/class-et-builder-element.php on line 12385

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /home/xtina102050/public_html/wp-content/themes/Divi/includes/builder/class-et-builder-element.php on line 10422

Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/xtina102050/public_html/wp-content/themes/Divi/includes/builder/class-et-builder-element.php on line 12385

Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/xtina102050/public_html/wp-content/themes/Divi/includes/builder/class-et-builder-element.php on line 12385

Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/xtina102050/public_html/wp-content/themes/Divi/includes/builder/class-et-builder-element.php on line 12385

Share

Try adding the code below to your Visual Basic Editor. It should remove all tabs.

Sub RemoveTabs()

With ActiveDocument
With .Range
With .Find
.Forward = True
.Wrap = wdFindContinue
.Text = “^t”
.Replacement.Text = “”
.Execute Replace:=wdReplaceAll
End With
End With
End With
End Sub

NOTE: Once you copy this, you might find that the quote marks have been changed.  Replace them with regular quote marks and the routine should run correctly.

This illustration shows a page with tabs throughout the first several paragraphs.

This is the same page after the macro was run.

2 Comments

  1. oprol evorter

    Hmm is anyone else experiencing problems with the images on this blog loading? I’m trying to determine if its a problem on my end or if it’s the blog. Any feed-back would be greatly appreciated.

    Reply
    • Laura

      It’s not you, there were no images on this blog. It was just a snippet of code that I posted on another forum. I just added the images.

      Thanks for your comment!

      Reply

Leave a Reply to oprol evorter Cancel reply

Your email address will not be published. Required fields are marked *

Share