B
Ben Bullock
I am using Microsoft Word 2003 and trying to write a macro which
corrects some indenting problems in the cells of a document. I have a
problem in that I do not seem to be able to set the value of
FirstLineIndent, the indentation.
Here is a macro I've written to try to demonstrate the problem I'm
encountering:
Sub DoAllIndents()
Dim NowIndent As Long
For Each Tbl In ActiveDocument.Tables
For Each Row In Tbl.Rows
For Each cellLoop In Row.Cells
With cellLoop.Range
MsgBox (.Text)
NowIndent = .Paragraphs(1).FirstLineIndent
MsgBox (NowIndent)
.Paragraphs(1).FirstLineIndent = 0
MsgBox (.Paragraphs(1).FirstLineIndent)
End With
Next cellLoop
Next Row
Next Tbl
End Sub
The problem is that setting "FirstLineIndent" does nothing: the second
MsgBox gives the same value as the first one. Apart from using
Range.Paragraphs(1), I've also used .ParagraphFormat.FirstLineIndent
with exactly the same results. The document itself is not read-only,
but "FirstLineIndent" seems to be.
I've googled for some hints but have not been able to make the above
work properly.
Thank you very much indeed for any help with this problem.
corrects some indenting problems in the cells of a document. I have a
problem in that I do not seem to be able to set the value of
FirstLineIndent, the indentation.
Here is a macro I've written to try to demonstrate the problem I'm
encountering:
Sub DoAllIndents()
Dim NowIndent As Long
For Each Tbl In ActiveDocument.Tables
For Each Row In Tbl.Rows
For Each cellLoop In Row.Cells
With cellLoop.Range
MsgBox (.Text)
NowIndent = .Paragraphs(1).FirstLineIndent
MsgBox (NowIndent)
.Paragraphs(1).FirstLineIndent = 0
MsgBox (.Paragraphs(1).FirstLineIndent)
End With
Next cellLoop
Next Row
Next Tbl
End Sub
The problem is that setting "FirstLineIndent" does nothing: the second
MsgBox gives the same value as the first one. Apart from using
Range.Paragraphs(1), I've also used .ParagraphFormat.FirstLineIndent
with exactly the same results. The document itself is not read-only,
but "FirstLineIndent" seems to be.
I've googled for some hints but have not been able to make the above
work properly.
Thank you very much indeed for any help with this problem.