When I set the Aspect Ratio lock on a shape:
Shape.CellsSRC(visSectionObject, visRowLock, visLockAspect).FormulaU = "1"
it works with the UI but not if I set shape width directly, with
Shape.CellsU("Width).FormulaU = "1 in"
for instance. The aspect ratio is changed. Is there a way to change the size via VBA of a shape where the Aspect Ratio lock just corrects the other dimension automatically to keep the aspect ratio unchanged?
This is definitely a bug!
As work around you may check for this protection (shp.Cells("LockAspect").ResultIU = 1) and correct the other dimension accordingly.
As this would be tedious to write in your regular code and you may forget it, a function could help
eg instead of targeting the width or height directly, you would call a "setWidth" / "setHeight" function.
Good to know this is a bug, I just added an aspect ratio correction to my code but was indeed surprised that the aspect ratio isn't enforced for code changing width or height.
I suppose it is a bug of a sort, but it's probably designed behaviour right from the start, so changing it might break stuff.
Jein (= Ja and Nein = Yes and No).
Whilst there will always be situations where you'll need to prevent stuff to break, you still have a (kind of) responsibility of keeping the logic understandable and consistent.
In this case, at least a warning, would notify the user of unsuitable commands.
Not the finest of what they've done so far.