No anwsers ?

B

Bart Hernalsteen

Hi all,

I'm not frequently using newsgroups, so I wonder what is wrong with a
non-answered post.
Is the question to difficult ?
Is it to stupid ?
Is someone trying to solve it ? How many days do I have to wait ?
What can I do when I recieve no answers ?
Can I post it again in the same newsgroup ?

This is concerning the post "Table resize stepping/running" on 29/7/2003
There was a similar post from "Jackie" on 11/6/2003 "Stepping/running code
(2000/XP)"

Thanks in advance

Bart Hernalsteen
 
D

Dave Lett

Hi Bart,

Not too hard, but took some research. In my limited experience, if you leave
the preferred width check box selected (or do the equivalent in code), then
Word reserves the right to resize the column because, after all, you have
indicated only that you "prefer" that width. To make the column the exact
width, you have to clear the preferred width check box. Have a look at the
following (something that I've used in the past with Word 2000 that sets the
width of the columns in the specified range and table exactly):

' set the preferred width for the table to false
tblTokens.PreferredWidth = False
' set the preferred width for all the layout columns
' rng.columns was 0.5
Rng.Columns.PreferredWidth = InchesToPoints(0.25)

HTH
 
R

Rob Barnard

Hi,

I'm sure this can be very frustrating. I've not seen your
original question but I don't bother replying if the
question is not crsytal clear / ambiguous. Make sure that
your question gives all the details required to answer it.

Rob

-----Original Message-----
Hi all,

I'm not frequently using newsgroups, so I wonder what is wrong with a
non-answered post.
Is the question to difficult ?
Is it to stupid ?
Is someone trying to solve it ? How many days do I have to wait ?
What can I do when I recieve no answers ?
Can I post it again in the same newsgroup ?

This is concerning the post "Table resize stepping/running" on 29/7/2003
There was a similar post from "Jackie" on
11/6/2003 "Stepping/running code
 
B

Bart Hernalsteen

Dave,

I've addes the line "mytable.preferredwidth = false". It does not help.

I've searched a little further I think the table will not resize because I
delete the first row of my table after I've resized.
Is this possible ?
Does the first row of a table contains all the sizes ?

Regards

Bart
 
D

Dave Lett

Thanks, Klaus,

Yep, I was wrong again, and find the line in my sample code that Klaus
mentions:

oTbl.AutoFitBehavior wdAutoFitFixed

sorry to have led you down the wrong path.

Dave
 
B

Bart Hernalsteen

Hi,

I've tried both settings AllowAutoFit and AutoFitBehaviour. Is doesn't work.
DoEvents or Application refresh does not help either.

Why is it working fine in debug mode ?

When I remove the last line in my sub ("MyTable.Rows(1).Delete") Then it
works fine in execute mode also
The table resizes after 3 seconds.

I have this problem in Word Xp
In Word 2000 it works fine. Is this a bug in Word Xp ?

Thanks in advance

Bart

Sub ResizeTable()

Dim MyTable As Table

Set MyTable = Selection.ConvertToTable(Separator:=wdSeparateByTabs,
AutoFitBehavior:=wdAutoFitFixed)

' To achieve what you wanted to do, you can either set
MyTable.AllowAutoFit = False

' Or, this will also be set automatically if you use
' MyTable.AutoFitBehavior wdAutoFitFixed

MyTable.Columns(1).PreferredWidthType = wdPreferredWidthPoints
MyTable.Columns(1).PreferredWidth = CentimetersToPoints(2.4)
MyTable.Columns(2).PreferredWidthType = wdPreferredWidthPoints
MyTable.Columns(2).PreferredWidth = CentimetersToPoints(5.4)
MyTable.Columns(3).PreferredWidthType = wdPreferredWidthPoints
MyTable.Columns(3).PreferredWidth = CentimetersToPoints(0.4)

MyTable.Rows(1).Delete

End Sub
 
K

Klaus Linke

Hi Bart,

Both Dave and I use Word2000, where the code you posted works without a
problem (as you said).

Even if you leave out the line
MyTable.AllowAutoFit = False
it works fine, since you've already set the AutoFitBehaviour when you
created the table.

I hope somebody with Word2002 can say if the problem is reproducible.

What exactly does go wrong? Don't the columns resize at all?

Also, you could put in
Msgbox (MyTable.AllowAutoFit = False)
at the end of the macro, or check the corresponding check box in "Table >
Table properties > Options" to see if the setting got changed somewhere in
the macro.

Off the hat, I have no idea at all what could go wrong with your code.

Regards,
Klaus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top