Programming the macro to add to margin

R

rhamre

Ok, I really didn't want to ask this here, and i wanted to figure this out
without help.

Also, keep in mind i have no VB experience/VBA experience.

I have a macro, it does a variety of things.... one thing it needs to do now
is go through the document by finding specific entries, then when it finds
the entry, go into paragraphformat, and add "0.2" to whatever the current
margin is set at.

If anyone could offer input, it would be greatly appreciated.

This is what i have so far-

With Selection.Find
.Text = "Except*:"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
Do While .Execute
With Selection.ParagraphFormat
.LeftIndent = (.LeftIndent + 0.2)
End With
Loop
End With
 
J

Jay Freedman

Your code looks perfectly OK except for one thing. The .LeftIndent property
is measured in points, not inches, so you're increasing it by only 0.2
points. VBA then rounds that off to the nearest point -- which is no change
at all. Instead, use this:

.LeftIndent = .LeftIndent + InchesToPoints(0.2)
 
R

rhamre

That's it.... thanks a grip.

Jay Freedman said:
Your code looks perfectly OK except for one thing. The .LeftIndent property
is measured in points, not inches, so you're increasing it by only 0.2
points. VBA then rounds that off to the nearest point -- which is no change
at all. Instead, use this:

.LeftIndent = .LeftIndent + InchesToPoints(0.2)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top