

Set Tbl = (Range:=Selection.Range, NumRows:=1, NumColumns:=3, _ĭefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=False) What am I doing wrong? How can I fix this to always see the correct width immediately and not run into those problems in VBA 2016?Ĭan you recommend any other way to create a table of 3 columns with predefined width like this?Ĭonst text_b As String = "A longer text to make the column need more width" = CentimetersToPoints(13.4)ĭoEvents: DoEvents: DoEvents: DoEvents: DoEvents PreferredWidth = CentimetersToPoints(17.5) PreferredWidthType = wdPreferredWidthPoints Text_b = "A longer text to make the column need more width"Ī Range:=Selection.Range, NumRows:=1, NumColumns:=3, _ĭefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=False As you can see, the width should be adjusted long before the message box appears.! Because it uses the exact same commands.įollowing are the VBA commands used for the test. I assume this readjustment for some reason does not happen anymore for VBA 2016. Only after clicking "ok" and another pause, then the table will magically readjust its width. As you can see, when the Messagebox arrives, the width has not been set. I also put a MsgBox for your comparison in screenshot. To simulate that on 2010, I put a content-less loop after the table creation.
TEXT TO TABLE WORD MACRO SPEED FULL
Only if the original macro is run "at full speed" (also as part of a much larger macro cascade), then the width is ignored. When stepping through the macro one command at a time, it will work on 2016 as well.

This width setting does not take effect on 2016 but does on 2010.

However during Investigation I found out, even Word 2010 will behave differently depending if I set a breakpoint in VBA or not. I am investigating a VBA issue where Word 2016 behaves differently than Word 2010.
