Consulting

Results 1 to 2 of 2

Thread: VBA ...Table resize to the Maximum width after delete table row

  1. #1

    Exclamation VBA ...Table resize to the Maximum width after delete table row

    Hi all,

    I had a program that writing the report to MS Word from MS Access Marco. The MS Access references from a pre-defined template. The Word table is generated in run-time from the Access Macro. Therefore, all tables creation width/column sizing are generated in run-time.

    First, the code calls the document to split the page into two columns.
    Starting from left-handed size, the table is sizing to 3.55" with 3 columns (2.15", 0.7" and 0.7"), the 1st row contains the "header" text.
    Then, the table row expanded line-by-line depending the size of the record row (The ancestor written in that way).
    When the data is populated to the tables (saying there are 40 rows), the control returns to the 1st row and call the "word.selection.tables(1).row(1).delete" to remove the 1st row.

    The code works fine under MS Office 2010.

    However, when the MS office upgrade to 2013, the code in some occasions the table width is changed to 22" by when calling the "word.selection.tables(1).row(1).delete"

    Below is the code that it creates the table on MS Word from Access Macro
    objword.documents(1).Tables.Add <range>, <# of rows>, <# of columns>, wdWord9TableBehavior, wdAutoFitFixed


    Any Suggestion? Thx

    Karl

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Show us the actual code you're using for both the creation & population of the table, plus the deletions.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •