Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-10-2012, 06:30 PM
ubns ubns is offline Table Formatting Windows 7 32bit Table Formatting Office 2010 32bit
Competent Performer
Table Formatting
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default

I have kind of got the following code and ammended little bit. Here is a code:


' resize tables
Sub TablesOptimize()
Dim myTable As Table
For Each myTable In ActiveDocument.Tables
myTable.AutoFitBehavior (wdAutoFitContent)

myTable.AutoFormat Format:=35


' 35 is good format of table. can it bit lighter. how to create your own style
' and then include it. also how to change font and also include dollay symebol.
'With myTable.Borders
' .InsideLineStyle = wdLineStyleDot
' .OutsideLineStyle = wdLineStyleDouble

'End With
Next myTable

ActiveDocument.Repaginate

For Each myTable In ActiveDocument.Tables
myTable.AutoFitBehavior (wdAutoFitWindow)
Next myTable

ActiveDocument.Repaginate
For Each myTable In ActiveDocument.Tables
myTable.AutoFitBehavior (wdAutoFitFixed)
Next myTable
ActiveDocument.Repaginate
End Sub


I wanted to seek help regarding the following:



1) How can we write the complete code (sentence) if I have to change the font size using mytable.autoformat.

2) Is there a way we can change the table style, align the text in the centre of the cell, change the font size to 9.

3) We want to do this on selective tables, not all tables.



Regards

Last edited by macropod; 04-10-2012 at 06:35 PM. Reason: Stripped off content relating to another thread.
Reply With Quote
  #2  
Old 04-10-2012, 09:01 PM
macropod's Avatar
macropod macropod is offline Table Formatting Windows 7 64bit Table Formatting Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I don't know what you mean by (1).
For (2), you should define a Style with the required attributes.
For (3), you could use the following macro, provided you change "MyStyle" to whatever Style name you create in (2):
Code:
Sub TableOptimize()
Dim myTable As Table
If Selection.Information(wdWithInTable) = False Then Exit Sub
Set myTable = Selection.Tables(1)
With myTable
  .Range.Style = "MyStyle"
  .AutoFitBehavior (wdAutoFitContent)
  .AutoFormat Format:=wdTableFormatContemporary '35
  .AutoFitBehavior (wdAutoFitWindow)
  .AutoFitBehavior (wdAutoFitFixed)
End With
End Sub
Also, I doubt that all the AutoFitBehavior statements are required. I've left them in only because I don't know whether they might all be needed for your table.

PS: Please use code tags (see the advanced tab) when posting code.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Table of Contents Formatting Problem WilltheGrill09 Word 1 01-08-2012 12:57 PM
Table Formatting Formatting text in a table of contents newbie Word 1 12-28-2009 02:48 AM
Number formatting in Word table 8braitp Word Tables 0 08-27-2009 04:12 AM
Table Formatting Table of contents after formatting! erika Word 1 06-10-2009 10:40 AM
Table of Contents Formatting Rick5150 Word 1 03-16-2009 11:10 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:03 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft