In Word 2016, embedded Excel tables can not be scaled via VBA

The context

I have a word with several embedded Excel tables. These Excel tables vary in width. I'm trying to adjust Excel spreadsheet widths with VBA code so that they are optimized for the page width of my Word document.


  1. I use online forms instead of Excel related. Unfortunately, this is given and can not be changed easily, I suppose.
  2. Each update opens Excel. Everything is very slow
  3. In some tables, the last columns of Excel are not visible in Word. Is there a Black Magic assignment needed in Excel to assign the range to display in Word?

Code Listing 1

In this example, the properties .ScaleWidth and .ÉchelleHauteur has no effect on the size of the tables in Word.

For each form in ActiveDocument.InlineShapes
If oShape.Type = wdInlineShapeEmbeddedOLEObject, then
If left (oShape.OLEFormat.ProgID, 5) = "Excel" Then
oShape.OLEFormat.Object.Application.Worksheets (1) .Activate
oShape.ScaleWidth = x something calculated
oShape.ScaleHeight = y & # 39; something calculated
End if
End if
Next oShape

Code Listing 2

In this example, the properties .Width and .Size to size the tables in Word. Whatever the case may be, the excels are immediately refreshed when I return to my Word document at their original widths and heights.

oShape.Width = x something calculated
oShape.Height = y & # 39; something calculated