Inserted AutoText table incorrectly formatted - unless macro paused!
Hi,
I have some code that worked fine in Word 2003 but is going wrong in 2010. It just adds an autotext entry into the document: a single cell table. This table has been formatted to have:
PreferredWidthType = wdPreferredWidthPercent and
PreferredWidth = 100
When VBA is used to insert this autotext table inside another table (which happens all the time as the document is formatted as a two-column table), the preferred width type reverts to wdPreferredWidthPoints and becomes too wide. The strange thing is that if I put a breakpoint or a Stop ANYWHERE in this code and then run and resume the macro, all is well. Is this some kind of refresh issue? I've tried putting a Sleep delay AFTER the line that inserts the autotext into the code but curiously the table only gets inserted after the delay. I've tried also putting code that explicitly changes the preferred width options to percent/100 after the Sleep delay and this is ignored.
Any ideas gratefully received...
|