Resetting the size of an embedded Word document by VBA

yernubear

New Member
Joined
Nov 24, 2015
Messages
1
I have worksheet with an embedded Word document. I used the Word document to write summaries with full formatting and spell check.

The issue is that the if the text of the summary has more or less lines than it did before it was edited, the embedded object gets resized internally(that is the "original size" changes to accomdate the change in the text), but height of the the embedded object on the worksheet does not, so the text either gets compressed or stretched vertically to fit within the shape, rather than the shape resizing to fit the text. I have to manually select the embedded shape, right click Format Object, click the Size tab, uncheck Lock aspect ratio and click Reset. It works whether or not Relative to original picture size was checked (and that may be part of the issue).

I have tried to use this...

ActiveSheet.Shapes("Remarks").ScaleHeight 1.0, msoTrue, msoScaleFromTopLeft

However, I get an error stating it only applies to pictures. Of course, if the msoTrue were msoFalse, it changes the height by the factor, which I have no way of knowing after the length of the of the text has changed without using the manual route..

I am trying to get the embedded shape to automatically resize with a macro.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,223,711
Messages
6,174,020
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top