Hello All,
My inexperience is showing here and I hope someone can help.
I have some VBA code in an Excel workbook that creates a Word document then copies various objects from the workbook to various associated bookmarks in the Word document.
After I have completed copying and pasting some ranges to Word as Word tables, I want to go and for each table set the AutoFitBehavior to fit all the tables to the window. I am trying use this bit of code ...
I do not get any errors, but it does not work. I tried enclosing the wdAutoFitWindow inside parantheses like this ...
but no difference.
Appreciate any insight on how I might fix this.
Regards,
Steve
My inexperience is showing here and I hope someone can help.
I have some VBA code in an Excel workbook that creates a Word document then copies various objects from the workbook to various associated bookmarks in the Word document.
After I have completed copying and pasting some ranges to Word as Word tables, I want to go and for each table set the AutoFitBehavior to fit all the tables to the window. I am trying use this bit of code ...
PHP:
....
On Error GoTo 0
For Each mytable In newWord.tables
mytable.AutoFitBehavior wdAutoFitWindow
Next
....
I do not get any errors, but it does not work. I tried enclosing the wdAutoFitWindow inside parantheses like this ...
PHP:
....
On Error GoTo 0
For Each mytable In newWord.tables
mytable.AutoFitBehavior (wdAutoFitWindow)
Next
....
but no difference.
Appreciate any insight on how I might fix this.
Regards,
Steve
Last edited: