VBA to Lock Aspect Ratio of Comment Picture

dplum

Board Regular
Joined
Nov 1, 2006
Messages
217
I've searched the form and found http://www.mrexcel.com/forum/showthread.php?t=145934&highlight=vba+comment+lock+aspect -- however, it does not answer the question I have.

I've used the macro recorder on a cell with a comment, containing a picture, to generate the following code...
Code:
Sub Comment_Chg_LockAspectRatio()
    Selection.ShapeRange.Fill.Transparency = 0#
    Selection.ShapeRange.Line.Weight = 0.75
    Selection.ShapeRange.Line.DashStyle = msoLineSolid
    Selection.ShapeRange.Line.Style = msoLineSingle
    Selection.ShapeRange.Line.Transparency = 0#
    Selection.ShapeRange.Line.Visible = msoTrue
    Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 0)
    Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
    Selection.ShapeRange.Fill.Visible = msoTrue
    Selection.ShapeRange.Fill.ForeColor.RGB = RGB(255, 255, 255)
    Selection.ShapeRange.Fill.BackColor.RGB = RGB(255, 255, 225)
    Selection.ShapeRange.Fill.UserPicture "image12.gif"
End Sub
During the macro recording I changed the "Lock Aspect Ratio" checkbox to either on/off. However, code does not get generated to make this change.

Can someone help by giving me a statement that would set the "Lock Aspect Ratio" either on or off?
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Selection.ShapeRange.LockAspectRatio = msoTrue
and
Selection.ShapeRange.LockAspectRatio = True

does not change the Aspect Ratio setting... is there something else that needs to be done to make the Lock Aspect Ratio work?
 
Upvote 0
If a macro is recorded, but not everything is recorded, this just means that there is no support in VBA for that.

Jay Freedman said:
Lock Picture Aspect Ratio

Unfortunately, you're correct. There are far too many cases of controls in
built-in dialogs that have no support in VBA. In each release the MVPs have
asked again to have this fixed, but so far without success.


(....)

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,142
Members
448,551
Latest member
Sienna de Souza

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