[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Changing Paragraph Indent Margins via VBA

Posted on 2006-04-21
2
Medium Priority
?
1,555 Views
Last Modified: 2008-03-06
Hello all.

I have a macro which moves through the document based on the paragraphs collection.

It then tests the paragraph indent and changes it based on what it finds.

The problem being, the macro runs exceedingly slowly on any document that contains a table.

How would I go about excluding tables from being found and evaluated by the Paragraphs collection?

Any advice would be helpful.

Thanks.
0
Comment
Question by:Drakos13
2 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 16514354
You don't show your code, so it's not clear if your problem is finding the tables, or excluding them from the process.
This code will still find paragraphs in tables, but will not process them.

Sub IndentParagraphs()
    Dim para As Paragraph
    For Each para In ActiveDocument.Paragraphs
        If para.Range.Tables.Count = 0 Then
            para.Format.LeftIndent = CentimetersToPoints(3)
        End If
    Next para
End Sub
0
 

Author Comment

by:Drakos13
ID: 16582628
Another winner.

That works perfectly.

Thanks again!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question