Tables generated in word 2010 don't work on word 2016 (VBA) RRS feed

  • Question

  • Hey guys, I am having issues with a macro that  I made in Word 2010, my company just upgraded to Office 16 and now I'm having issues.

    This is part of the code I have

    t.Columns(1).PreferredWidthType = wdPreferredWidthPoints
    t.Columns(1).PreferredWidth = 205
    t.Columns(2).PreferredWidthType = wdPreferredWidthPoints
    t.Columns(2).PreferredWidth = 35 
    t.Columns(3).PreferredWidthType = wdPreferredWidthPoints
    t.Columns(3).PreferredWidth = 45
    t.Columns(4).PreferredWidthType = wdPreferredWidthPoints
    t.Columns(4).PreferredWidth = 33
    t.Columns(5).PreferredWidthType = wdPreferredWidthPoints
    t.Columns(5).PreferredWidth = 42
    t.Columns(6).PreferredWidthType = wdPreferredWidthPoints
    t.Columns(6).PreferredWidth = 42
    t.Columns(7).PreferredWidthType = wdPreferredWidthPoints
    t.Columns(7).PreferredWidth = 42

    The issue is, if I let the macro run, the width doesn't stick, looks like all the columns are the same width.

    Now the weird part is that, if i put a break point in there, step through the code a few lines and then F5 to keep running it, the table comes out with the correct column widths.

    This is driving me insane and I cannot figure out why this is happening.

    I changed the preferredwidth to percentages and it is the same thing.

    The thing is, the code works! But only if you step through it.

    If anyone have any ideas on what is going on here, the help will be appreciated.


    Wednesday, May 9, 2018 10:20 PM

All replies

  • Hello r00tcracker,

    Does the "t" a table object? I tried to create a table in Word 2016 and then do the test, the code works well for me.

    You said that "Tables generated in word 2010 don't work on word 2016" in the title. Do you it only fails on documents created by word 2010? If you create a table in word 2016, will the code work?

    Besides, I would suggest you share the whole code in case of effects from other part code.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Thursday, May 10, 2018 5:08 AM