A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Format All Tables



 
 
Thread Tools Display Modes
  #1  
Old June 10th, 2004, 07:25 PM
Kevin Barmish
external usenet poster
 
Posts: n/a
Default Format All Tables

Windows 2000 Pro
MS Word 200

I am using a Third-Party Database program that generates long MS Word files.
These files contain hundreds of tables with border set to "NONE".
What I would like to do is make the borders on all tables "ALL".
To do this for an individual table I would:
1) Select table
2) Table Properties
3) Borders and Shading
4) Change the setting from "None" to "All"
5) Click Ok, Click Ok, to apply changes
Doing this procedure to each individual table would be too long and tedious
and thus I am looking for a solution to somehow apply these changes to all
tables in the document.

1) Is there a way to do this using Built-In MS Word features,
2) Or, is anyone able to think of an algorithm I can use to make a macro
to complete my task

There is "no solution" according to the Third-Party software company to
correct the issue from the DB Software end, and thus my only hope is to do
it in Word.

Thank you for your help,

Kevin Barmish


  #2  
Old June 10th, 2004, 09:03 PM
Greg
external usenet poster
 
Posts: n/a
Default Format All Tables

Asked and answered in Page Layout.


-----Original Message-----
Windows 2000 Pro
MS Word 200

I am using a Third-Party Database program that generates

long MS Word files.
These files contain hundreds of tables with border set

to "NONE".
What I would like to do is make the borders on all

tables "ALL".
To do this for an individual table I would:
1) Select table
2) Table Properties
3) Borders and Shading
4) Change the setting from "None" to "All"
5) Click Ok, Click Ok, to apply changes
Doing this procedure to each individual table would be

too long and tedious
and thus I am looking for a solution to somehow apply

these changes to all
tables in the document.

1) Is there a way to do this using Built-In MS Word

features,
2) Or, is anyone able to think of an algorithm I can

use to make a macro
to complete my task

There is "no solution" according to the Third-Party

software company to
correct the issue from the DB Software end, and thus my

only hope is to do
it in Word.

Thank you for your help,

Kevin Barmish


.

  #3  
Old June 11th, 2004, 12:44 AM
Charles Kenyon
external usenet poster
 
Posts: n/a
Default Format All Tables

This macro seems to work in Word 2003. Should work in earlier versions.

Sub TableBorderOn()
' Written by Charles Kyle Kenyon 10 June 2004
' Applies Borders to all tables in document
'
Dim oTable As Table
Dim varLineStyle As Variant
Dim varLineWidth As Variant
Dim varBorderColor As Variant
'
' Assign styles to lines and borders
'
varLineStyle = wdLineStyleSingle
varLineWidth = wdLineWidth050pt
varBorderColor = wdColorAutomatic
'
' Make these defaults
'
With Options
.DefaultBorderLineStyle = varLineStyle
.DefaultBorderLineWidth = varLineWidth
.DefaultBorderColor = varBorderColor
End With
'
' Reset borders on all tables in document
'
For Each oTable In ActiveDocument.Tables
With oTable
With .Borders(wdBorderLeft)
.LineStyle = varLineStyle
.LineWidth = varLineWidth
.Color = varBorderColor
End With
With .Borders(wdBorderRight)
.LineStyle = varLineStyle
.LineWidth = varLineWidth
.Color = varBorderColor
End With
With .Borders(wdBorderTop)
.LineStyle = varLineStyle
.LineWidth = varLineWidth
.Color = varBorderColor
End With
With .Borders(wdBorderBottom)
.LineStyle = varLineStyle
.LineWidth = varLineWidth
.Color = varBorderColor
End With
With .Borders(wdBorderHorizontal)
.LineStyle = varLineStyle
.LineWidth = varLineWidth
.Color = varBorderColor
End With
With .Borders(wdBorderVertical)
.LineStyle = varLineStyle
.LineWidth = varLineWidth
.Color = varBorderColor
End With
.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
.Borders.Shadow = False
End With
Next oTable
End Sub

This assumes only horizontal and vertical borders (no diagonals). Hope this
helps.
--

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.


"Kevin Barmish" wrote in message
...
Windows 2000 Pro
MS Word 200

I am using a Third-Party Database program that generates long MS Word

files.
These files contain hundreds of tables with border set to "NONE".
What I would like to do is make the borders on all tables "ALL".
To do this for an individual table I would:
1) Select table
2) Table Properties
3) Borders and Shading
4) Change the setting from "None" to "All"
5) Click Ok, Click Ok, to apply changes
Doing this procedure to each individual table would be too long and

tedious
and thus I am looking for a solution to somehow apply these changes to all
tables in the document.

1) Is there a way to do this using Built-In MS Word features,
2) Or, is anyone able to think of an algorithm I can use to make a

macro
to complete my task

There is "no solution" according to the Third-Party software company to
correct the issue from the DB Software end, and thus my only hope is to do
it in Word.

Thank you for your help,

Kevin Barmish




  #4  
Old June 11th, 2004, 02:58 PM
Kevin Barmish
external usenet poster
 
Posts: n/a
Default Format All Tables

Greg, EXACTLY what I wanted, thank you very much...
Just so you know MS Tech Support was unable to assist...
I didn't know you could activate individual tables in the macro... awesome
and thanks

Kevin


"Kevin Barmish" wrote in message
...
Windows 2000 Pro
MS Word 200

I am using a Third-Party Database program that generates long MS Word

files.
These files contain hundreds of tables with border set to "NONE".
What I would like to do is make the borders on all tables "ALL".
To do this for an individual table I would:
1) Select table
2) Table Properties
3) Borders and Shading
4) Change the setting from "None" to "All"
5) Click Ok, Click Ok, to apply changes
Doing this procedure to each individual table would be too long and

tedious
and thus I am looking for a solution to somehow apply these changes to all
tables in the document.

1) Is there a way to do this using Built-In MS Word features,
2) Or, is anyone able to think of an algorithm I can use to make a

macro
to complete my task

There is "no solution" according to the Third-Party software company to
correct the issue from the DB Software end, and thus my only hope is to do
it in Word.

Thank you for your help,

Kevin Barmish




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:05 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.