Reply
 
Thread Tools Display Modes
  #1   Report Post  
Fred Holmes
 
Posts: n/a
Default Obtaining the Width of a _Table_

Word 2003, Win XP

The following code very nicely gets the width of a cell/column in a
table.

If Selection.Information(wdWithInTable) = True Then
MsgBox "The Width of the Cell is " & _
PointsToInches(Selection.Cells(1).Width) & " inches."
End If

But if I want to get the width of the whole table

Selection.Tables(1).Width

does not work and returns an "method or data member not found" error
message. Similarly, the following does not work.

Selection.Rows(1).Width

I know I could find the table/row width using a loop that would get
and add the width of each of the columns in the table, but is there a
direct way to get the width of a table/row.

Thanks,

Fred Holmes
  #2   Report Post  
Jezebel
 
Posts: n/a
Default

Did you try scrolling through the object's properties to see what's there?
For a table, the value is called .PreferredWidth.





"Fred Holmes" wrote in message
news
Word 2003, Win XP

The following code very nicely gets the width of a cell/column in a
table.

If Selection.Information(wdWithInTable) = True Then
MsgBox "The Width of the Cell is " & _
PointsToInches(Selection.Cells(1).Width) & " inches."
End If

But if I want to get the width of the whole table

Selection.Tables(1).Width

does not work and returns an "method or data member not found" error
message. Similarly, the following does not work.

Selection.Rows(1).Width

I know I could find the table/row width using a loop that would get
and add the width of each of the columns in the table, but is there a
direct way to get the width of a table/row.

Thanks,

Fred Holmes



  #3   Report Post  
Fred Holmes
 
Posts: n/a
Default

Yes, but I don't think "preferred width" is the same as actual
measured width (on the printed page). I've found that setting that
property, both for the table and for individual columns, yields
"unexpected results." And I've seen some derogatory comments about
that properties dialog in some books I've read, which is why I'm
trying to do it with VBA code instead of using that dialog.

Fred Holmes

On Thu, 11 Nov 2004 08:37:41 +1100, "Jezebel"
wrote:

Did you try scrolling through the object's properties to see what's there?
For a table, the value is called .PreferredWidth.





"Fred Holmes" wrote in message
news
Word 2003, Win XP

The following code very nicely gets the width of a cell/column in a
table.

If Selection.Information(wdWithInTable) = True Then
MsgBox "The Width of the Cell is " & _
PointsToInches(Selection.Cells(1).Width) & " inches."
End If

But if I want to get the width of the whole table

Selection.Tables(1).Width

does not work and returns an "method or data member not found" error
message. Similarly, the following does not work.

Selection.Rows(1).Width

I know I could find the table/row width using a loop that would get
and add the width of each of the columns in the table, but is there a
direct way to get the width of a table/row.

Thanks,

Fred Holmes



  #4   Report Post  
Jezebel
 
Posts: n/a
Default

Which properties dialog are you referring to?

I meant the object's properties as listed in VBA using Intellisense; or the
object browser. PreferredWidth is normally the actual width on the printed
page.



"Fred Holmes" wrote in message
...
Yes, but I don't think "preferred width" is the same as actual
measured width (on the printed page). I've found that setting that
property, both for the table and for individual columns, yields
"unexpected results." And I've seen some derogatory comments about
that properties dialog in some books I've read, which is why I'm
trying to do it with VBA code instead of using that dialog.

Fred Holmes

On Thu, 11 Nov 2004 08:37:41 +1100, "Jezebel"
wrote:

Did you try scrolling through the object's properties to see what's

there?
For a table, the value is called .PreferredWidth.





"Fred Holmes" wrote in message
news
Word 2003, Win XP

The following code very nicely gets the width of a cell/column in a
table.

If Selection.Information(wdWithInTable) = True Then
MsgBox "The Width of the Cell is " & _
PointsToInches(Selection.Cells(1).Width) & " inches."
End If

But if I want to get the width of the whole table

Selection.Tables(1).Width

does not work and returns an "method or data member not found" error
message. Similarly, the following does not work.

Selection.Rows(1).Width

I know I could find the table/row width using a loop that would get
and add the width of each of the columns in the table, but is there a
direct way to get the width of a table/row.

Thanks,

Fred Holmes





Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why does Word display "within margin" page width and lenght as 44. krb Microsoft Word Help 2 January 12th 05 05:53 PM
Setting width of pull-down menus? fastandfuriousbutbreakindown Microsoft Word Help 3 January 1st 05 05:12 AM
Forms text field minimum width LWert Microsoft Word Help 1 December 28th 04 09:02 PM
Minimum column width you can do on Word? Ace Tables 9 November 8th 04 11:44 PM
Can tables be permanently set to Fixed Column Width? Klaus Linke Tables 0 October 26th 04 04:27 PM


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

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"