I have a document in MS Word 2016 with 200+ pages and even more tables. I need to align all tables on odd pages to the left and I need all tables on even pages aligned to the right. Except for one or two tables which I can amend manually if needed none of the tables span multiple pages. Using
Dim oTable As Table
For Each oTable In ActiveDocument.Tables
oTable.Rows.Alignment = wdAlignParagraphRight
Next oTable
I can align all tables to the right. When using wdAlignParagraphLeft
instead of wdAlignParagraphRight
I can align all tables to the left. But I could not figure our how to get the page number of a table so that I can assign the alignment based on the page number a table is on.
(The idea is that if printed as a book, the table are always on the inner side. If there is a better way to accomplish that I'll be listening. If printed as a book and two pages are next to each other the tables should be at the inner side like this:)
+-------------------------------+
| Even Page | Odd page |
+---------------+---------------+
| |Table| | |Table| |
| | |
+-------------------------------+