Re: Need help with border removal in a cell



Hi Xavier


The problem is this line

With .Cell(tbl.Rows.Count - 2, 4).Range

This is applying the following lines to the Range object which marks the text in the cell, not the cell itself. Unfortunately, it is the Cell that has the borders, not the range

You need to change that block so that it reads as follows

       With .Cell(tbl.Rows.Count - 2, 4)
           .Range.Text = "Here !"
           .Borders(wdBorderBottom).LineStyle = wdLineStyleNone
           .Borders.Enable = True
       End With

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org

"Xavier" <xminet@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:%23DPnjla$FHA.272@xxxxxxxxxxxxxxxxxxxxxxx
Hi,

I've been trying for hours to remove the bottom border of a cell in a Word table. I must be missing something obvious, so I hope someone can help me:

The code I am using (from MS Access VBA) is the following:

With doc.Tables.Item(1)

       ' removing stuff that works

       With .Cell(tbl.Rows.Count - 2, 4).Range
           .Text = "Here !"
           .Borders(wdBorderBottom).LineStyle = wdLineStyleNone
           .Borders.Enable = True
       End With

       ' removing other stuff that works as well

End With

For that particular cell, I would like to have no bottom border drawn. I am sure I am referencing the right cell because I am putting the "Here !" text and it appears as expected.
I also checked that other contiguous cells formatting do not interfere with this one (e.g. activating the top border of the cell located under the one for which I want to remove the bootom border).


Any help would be appreciated.

Xavier


.



Relevant Pages

  • RE: Borders with Heading Rows Repeat
    ... If the cells are on different pages, a border must be added to ... the first cell. ... the same page and if the first cell has a bottom border (e.g. because it was ... Dim oRow As Row ...
    (microsoft.public.word.tables)
  • RE: Borders with Heading Rows Repeat
    ... If the cells are on different pages, a border must be added to ... the first cell. ... the same page and if the first cell has a bottom border (e.g. because it was ... Dim oRow As Row ...
    (microsoft.public.word.tables)
  • Re: How to test an adjacent cell for blank in conditional formatting
    ... I gave this the same pattern color, but added the border. ... If that cell ... conditional formatting, to do one or the other, or even both, if every ...
    (microsoft.public.excel)
  • Re: looping macro to test for borders
    ... If it's at the bottom cell where a bottom border exists, ... I want it to select all of the cells from TopCell to BotCell ...
    (microsoft.public.excel.programming)
  • Re: How to test an adjacent cell for blank in conditional formatting
    ... I gave this the same pattern color, but added the border. ... I want the pattern in any cell ... I can write the conditional formatting to do both with one condition, ...
    (microsoft.public.excel)

Loading