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  

how do i select and format all tables in a document at once



 
 
Thread Tools Display Modes
  #1  
Old July 2nd, 2006, 05:20 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default how do i select and format all tables in a document at once

i have a huge document (several hundred pages) with hundreds of tables
exported from a statistical analysis program (SPSS). specifically, i want to
make each table "autofit to contents", because this will reduce the size of
my output by a large amount. i can't seem to find a way to select all tables
at once; thus i cannot autofit all tables to contents at once.

thanks
  #2  
Old July 2nd, 2006, 06:56 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default how do i select and format all tables in a document at once

Try running the following macro:

Dim atable As Table
For Each atable In ActiveDocument.Tables
atable.AutoFitBehavior wdAutoFitContent
Next atable


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"j smith" j wrote in message
...
i have a huge document (several hundred pages) with hundreds of tables
exported from a statistical analysis program (SPSS). specifically, i want
to
make each table "autofit to contents", because this will reduce the size
of
my output by a large amount. i can't seem to find a way to select all
tables
at once; thus i cannot autofit all tables to contents at once.

thanks



  #3  
Old July 2nd, 2006, 10:32 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default how do i select and format all tables in a document at once

i can't make it work using this macro. i pasted it into a vb editor window
so it reads like the following:


Sub spss()
Dim atable As Table
For Each atable In ActiveDocument.Tables
atable.AutoFitBehavior wdAutoFitContent
Next atable
End Sub

then i ran it from within word (version 2003).
nothing happened. am i doing it correectly?

many thanks

"Doug Robbins - Word MVP" wrote:

Try running the following macro:

Dim atable As Table
For Each atable In ActiveDocument.Tables
atable.AutoFitBehavior wdAutoFitContent
Next atable


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"j smith" j wrote in message
...
i have a huge document (several hundred pages) with hundreds of tables
exported from a statistical analysis program (SPSS). specifically, i want
to
make each table "autofit to contents", because this will reduce the size
of
my output by a large amount. i can't seem to find a way to select all
tables
at once; thus i cannot autofit all tables to contents at once.

thanks




  #4  
Old July 3rd, 2006, 04:50 AM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default how do i select and format all tables in a document at once

More likely that

AutoFitBehavior wdAutoFitContent

is not what you are trying to do.

Try recording a macro of your taking the action one time and modify the code
that I gave you so that it incorporates the relevant part of the code that
is generated by the macro recorder.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"j smith" wrote in message
...
i can't make it work using this macro. i pasted it into a vb editor window
so it reads like the following:


Sub spss()
Dim atable As Table
For Each atable In ActiveDocument.Tables
atable.AutoFitBehavior wdAutoFitContent
Next atable
End Sub

then i ran it from within word (version 2003).
nothing happened. am i doing it correectly?

many thanks

"Doug Robbins - Word MVP" wrote:

Try running the following macro:

Dim atable As Table
For Each atable In ActiveDocument.Tables
atable.AutoFitBehavior wdAutoFitContent
Next atable


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"j smith" j wrote in message
...
i have a huge document (several hundred pages) with hundreds of tables
exported from a statistical analysis program (SPSS). specifically, i
want
to
make each table "autofit to contents", because this will reduce the
size
of
my output by a large amount. i can't seem to find a way to select all
tables
at once; thus i cannot autofit all tables to contents at once.

thanks






  #5  
Old July 5th, 2006, 06:25 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default how do i select and format all tables in a document at once

Also, if you have a long document with lots of tables, it may take quite a
while, up to minutes, for the tables to adjust to the new setting (which is
done in a background task).
You may be able to force that adjustment with a "ActiveDocument.Repaginate"
in your macro.

I sometimes first use AutoFit to Content, then to Window, and finally to
Fixed (so Word doesn't continually spend ressources in the background).
For that to work, I had to stick in an "ActiveDocument.Repaginate" after
each changing of the AutoFitBehaviour.

Regards,
Klaus



"Doug Robbins - Word MVP" schrieb im Newsbeitrag
...
More likely that

AutoFitBehavior wdAutoFitContent

is not what you are trying to do.

Try recording a macro of your taking the action one time and modify the
code that I gave you so that it incorporates the relevant part of the code
that is generated by the macro recorder.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"j smith" wrote in message
...
i can't make it work using this macro. i pasted it into a vb editor
window
so it reads like the following:


Sub spss()
Dim atable As Table
For Each atable In ActiveDocument.Tables
atable.AutoFitBehavior wdAutoFitContent
Next atable
End Sub

then i ran it from within word (version 2003).
nothing happened. am i doing it correectly?

many thanks

"Doug Robbins - Word MVP" wrote:

Try running the following macro:

Dim atable As Table
For Each atable In ActiveDocument.Tables
atable.AutoFitBehavior wdAutoFitContent
Next atable


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"j smith" j wrote in message
...
i have a huge document (several hundred pages) with hundreds of tables
exported from a statistical analysis program (SPSS). specifically, i
want
to
make each table "autofit to contents", because this will reduce the
size
of
my output by a large amount. i can't seem to find a way to select all
tables
at once; thus i cannot autofit all tables to contents at once.

thanks







  #6  
Old July 5th, 2006, 06:51 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default how do i select and format all tables in a document at once

I sometimes first use AutoFit to Content, then to Window, and finally to
Fixed (so Word doesn't continually spend ressources in the background).
For that to work, I had to stick in an "ActiveDocument.Repaginate" after
each changing of the AutoFitBehaviour.


I just checked my macro code, and it has in fact two .Repaginate's each
time:

Sub TablesOptimize()
Dim myTable As Table
For Each myTable In ActiveDocument.Tables
myTable.AutoFitBehavior (wdAutoFitContent)
Next myTable
ActiveDocument.Repaginate
ActiveDocument.Repaginate
For Each myTable In ActiveDocument.Tables
myTable.AutoFitBehavior (wdAutoFitWindow)
Next myTable
ActiveDocument.Repaginate
ActiveDocument.Repaginate
For Each myTable In ActiveDocument.Tables
myTable.AutoFitBehavior (wdAutoFitFixed)
Next myTable
ActiveDocument.Repaginate
ActiveDocument.Repaginate
End Sub

It seemed to work well... seems I had to tell Word twice, to emphasize that
I really meant it g.
Or maybe somebody has a better idea to force the tables to adjust to the new
setting/behaviour?

Greetings,
Klaus


  #7  
Old July 5th, 2006, 07:27 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default how do i select and format all tables in a document at once

Hi Klaus,

did you get my mail about programming QPS?

I count on you.

--
Cheers

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
  #8  
Old July 6th, 2006, 01:25 AM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default how do i select and format all tables in a document at once

"Helmut Weber" wrote:
Hi Klaus,

did you get my mail about programming QPS?

I count on you.



And lost... I don't even have an idea what QPS is.

Sorry!!
Klaus


 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
don't change format for entire word document MidCityRep General Discussion 3 November 17th, 2005 09:11 PM
How do I save an access document in word document? cmartin General Discussion 2 September 13th, 2005 11:26 PM
Word 2000/2002 - Proper Mail Merge steps for ODBC? Tony_VBACoder Mailmerge 7 September 2nd, 2004 09:21 PM
Excel Worksheets Richard General Discussion 2 July 8th, 2004 04:34 AM
Format All Tables Kevin Barmish Tables 3 June 11th, 2004 02:58 PM


All times are GMT +1. The time now is 12:56 AM.


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