table gridlines

S

Steve

How would I code the hiding of table gridlines for the full document using
word automation in vb.net?

Thanks

Steve
 
S

Shauna Kelly

Hi Steve

Gridlines (which never print, and are visual clues only) or Borders (the
lines on the edge of cells that print)?

If Borders then the following is an example of VBA code:

Dim oTable as Word.Table
For each oTable in ActiveDocument.Tables
With oTable.Borders(wdBorderLeft)
.LineStyle = wdLineStyleDot
.LineWidth = wdLineWidth225pt
.Color = wdColorBrightGreen
End With
Next oTable

I find that recording a macro is the easiest way to find out the settings
you need for your particular border requirements.

If Gridlines, then I would recommend leaving the user's setting alone. It's
not a per-table or per-document setting: it affects all the user's tables in
all documents. So my advice is to let the user decide what they see on the
screen unless you want very unhappy, very confused users who hang about in
the corridor outside the boss's office saying things like "ever since that
thing that Steve did got installed on my machine, I can't use tables in my
documents".

Hope this helps.

Shauna

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 
S

Steve

Borders. Thanks

Steve

Shauna Kelly said:
Hi Steve

Gridlines (which never print, and are visual clues only) or Borders (the
lines on the edge of cells that print)?

If Borders then the following is an example of VBA code:

Dim oTable as Word.Table
For each oTable in ActiveDocument.Tables
With oTable.Borders(wdBorderLeft)
.LineStyle = wdLineStyleDot
.LineWidth = wdLineWidth225pt
.Color = wdColorBrightGreen
End With
Next oTable

I find that recording a macro is the easiest way to find out the settings
you need for your particular border requirements.

If Gridlines, then I would recommend leaving the user's setting alone. It's
not a per-table or per-document setting: it affects all the user's tables in
all documents. So my advice is to let the user decide what they see on the
screen unless you want very unhappy, very confused users who hang about in
the corridor outside the boss's office saying things like "ever since that
thing that Steve did got installed on my machine, I can't use tables in my
documents".

Hope this helps.

Shauna

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 

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