Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

left indent button in a table giving me nightmares and bad sleep..

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi friends, Bija here..
I am trying to make a toolbar button macro in word 2000 which "increases" the left indent of the selected cells in a table by a fixed value (e.g. 0.3 cm). I am writing the following code to achieve this.

With Selection.Paragraphformat
.LeftIndent = .LeftIndent + 8.5
End With

This macro seems to work only once for the selected cells in the table.. after that it gives the error. When i change the code to :

With Selection.Paragraphs
.LeftIndent = .LeftIndent + 8.5
End With

All the cells in the table are affected.. instead of the selected cells.

Now i really require help from some of you gentlemen out there. Thanks in advance..


 
I do mean left indent
.LeftIndent + 8.5 means i wanna increase the left indent of the para by 0.3 cm.
Thanks.
 
instead of trying to set the left indent of the entire selection in one go, try setting it for each cell in the selection.

Code:
Dim oCell As Cell

if Selection.Cells.count > 0 then
  For Each oCell In Selection.Cells
    With oCell.Range.ParagraphFormat
      .LeftIndent = .LeftIndent + 8.5
    End With
  Next oCell
end if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top