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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word - table and BorderBottom

Status
Not open for further replies.

Andrzejek

Programmer
Jan 10, 2006
8,530
US
I have a table in Word with 5 columns:
[pre]
|---------------------------------------------|
| Entrances | | | | |
|---------------------------------------------|[/pre]
I have some text in first column and a bookmark in the second (cell) column. I can go to that bookmarks and enter a text, move to the next cell / column (by [tt]MoveRight Unit:=wdCell[/tt]) and enter more text. When I enter the text in the last column, I can still do [tt]MoveRight Unit:=wdCell[/tt] a couple of times - which adds another row of cells, and I am in the next row in the second column and I can keep adding my text. And all is great.

Now my user wants me to make 2nd, 3rd, 4th and 5th cell with BorderBottom (but not first column with the word "Entrances"), so when I am in the cell where I enter the text, I can do:

Code:
With Selection.Borders(wdBorderBottom)
    .LineStyle = Options.DefaultBorderLineStyle
    .LineWidth = Options.DefaultBorderLineWidth
    .Color = Options.DefaultBorderColor
End With

Which places the border on the bottom of the cell. Great.

But when I create/move to the next row, bottom border moves down, and the original cell is left without the bottom border. :-(
How can set the bottom border in the cell and have it stay there when I create a new row of cells in the table?


---- Andy

There is a great need for a sarcasm font.
 
Andy, what happens if you define an OUTSIDE border for the Table? I’m not at my laptop so I couldn’t test that.

So what part of this is coded? At some point, the first column will have a new value and you’ll need a bottom border in column 1.

Of course you could do that in Excel (with Entrances on each row) using Conditional Formatting to manage the in-table borders and font color to make Entrances appear invisible.

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]

"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein
 
I am redoing a letter one Department has for years.
This portion looks like this.

AC_01_tub0la.png


So in my Word template I have this:

AC_02_ekdgua.png


In line "Entrances will be constructed at Station(s)" they used to have just 4 spots for Entrances with bottom lines as all other cells above. That was easy because I did not have to add any rows in the table. But now I allow them to have unlimited number of Entrances, so I keep adding rows to my table as needed.

The lines are left over from the time they entered all of this data by hand, and now they want to continue with the lines.

It is not the end of the world, I can make them like it the way it is now...


---- Andy

There is a great need for a sarcasm font.
 
Well actually you have a Table with up to 7 columns and lots of merged cells at various places.

If you’re talking about this kind of form but allowing rows to be added at the bottom of each table where you have ...
[tt]
Entrances will be constructed at Station(s)
[/tt]
...with the RED lines under the 2 entries, your example of This portion, does not have a border under the Entrances...???

Not sure what the issue is.

Maybe a pic displaying the issue?

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]

"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein
 
Yes, the "7 columns and lots of merged cells at various places" was done by somebody else. I just deal with the bottom portion of this table.

So what I have right now (as a final product) is (the top portion), and what users may want is (the bottom):

AC_03_qsi5mt.png


BTW - I still have to talk to the users because what I have here and what they drew (in red) on their end is not the same thing. And I may be just chasing something a lot more complicated (split more cells)... [ponder]


---- Andy

There is a great need for a sarcasm font.
 
Assuming the table containing "Additional Length of Drive" is separate from the one before it, as your image shows, inserting new rows is quite straightforward. For example:
ActiveDocument.Tables(1).Rows.Add
where 1 is the table #.
If the table containing "Additional Length of Drive" is not separate from the one before it, inserting new rows is a little more involved:. For example:
Code:
With ActiveDocument.Range
  With .Find
  .ClearFormatting
  .Text = "Additional Length of Drive"
  .Execute
  End With
  If .Find.Found = True Then
    If .Information(wdWithInTable) = True Then
      With .Duplicate
        .InsertBreak Type:=wdColumnBreak
        .Tables(1).Rows.Add
        .Tables(1).Range.Characters.Last.Next.Delete
      End With
    End If
  End If
End With

Cheers
Paul Edstein
[MS MVP - Word]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top