Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-21-2012, 02:32 AM
tinfanide tinfanide is offline Word VBA: Resize Table Width??? Windows 7 64bit Word VBA: Resize Table Width??? Office 2010 32bit
Expert
Word VBA: Resize Table Width???
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default Word VBA: Resize Table Width???

ResizeTableWidth.zip

Please see the attachment (the VBA codes inside)

I want to resize the second table width.
The problem is:
there seems to be no Tables(index).Width in Word VBA
I know there is PreferredWidth
But I want to resize the last column width only.

I have already written the codes to do so in the attached file.
But I wonder if there is a simpler way to do so in VBA.


Please take a look if you are interested.
Reply With Quote
  #2  
Old 04-21-2012, 04:30 AM
macropod's Avatar
macropod macropod is offline Word VBA: Resize Table Width??? Windows 7 64bit Word VBA: Resize Table Width??? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

Hi tinfanide,

There is no attachment to your post - just an invlaid link. However, try something along the lines of:
Code:
Sub Demo()
With ActiveDocument.Tables(2)
  .Columns(.Columns.Count).Width = CentimetersToPoints(2#)
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 04-21-2012, 07:39 AM
tinfanide tinfanide is offline Word VBA: Resize Table Width??? Windows 7 64bit Word VBA: Resize Table Width??? Office 2010 32bit
Expert
Word VBA: Resize Table Width???
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default

The link is not working?
Anyway, just came up with a similar solution like yours.
Thanks.
Reply With Quote
  #4  
Old 04-21-2012, 01:41 PM
macropod's Avatar
macropod macropod is offline Word VBA: Resize Table Width??? Windows 7 64bit Word VBA: Resize Table Width??? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

Hi tinfanide,
Quote:
The link is not working?
The file it points to isn't a valid zip archive.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 04-21-2012, 02:42 PM
tinfanide tinfanide is offline Word VBA: Resize Table Width??? Windows 7 64bit Word VBA: Resize Table Width??? Office 2010 32bit
Expert
Word VBA: Resize Table Width???
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Hi tinfanide,

The file it points to isn't a valid zip archive.
Yeah... I don't know why. I did download it and open it on my machine. But when I tried that again at my friend's home, it said it was broken.
Reply With Quote
  #6  
Old 04-21-2012, 03:00 PM
macropod's Avatar
macropod macropod is offline Word VBA: Resize Table Width??? Windows 7 64bit Word VBA: Resize Table Width??? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

For future reference, you might do better attaching files via the paperclip symbol on this forum's 'Go Advanced' tab.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word VBA: Resize Table Width??? How to make the Caption and its text have the same width as the table? Jamal NUMAN Word 1 04-24-2011 06:44 PM
Word VBA: Resize Table Width??? Table of Contents width Jonart Word 2 03-31-2011 10:51 PM
Control cell width and wrapping in table. gcowan Word Tables 0 07-07-2010 11:28 AM
Resize-to-fit Table Columns (PowerPoint) icu222much PowerPoint 0 06-06-2010 11:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:50 PM.


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