Format Comment using VBA

Eric Strobel

New Member
Joined
Oct 4, 2018
Messages
4
I currently am able to use vba to comment a picture I have rooted in a specific cell, but am having trouble sizing it properly. My current code is below:

Sub Comment()

Set rng = ActiveSheet.Cells(9, 1)
rng.AddComment
rng.Comment.Text Text:=""
rng.Comment.Shape.Fill.UserPicture (Sheets("Metrics").Range("B31"))
rng.Comment.ShapeRange.ScaleWidth = Sheets("Metrics").Range("I44")
rng.Comment.ShapeRange.ScaleHeight = Sheets("Metrics").Range("K44")


End Sub

As stated prior, the image with root in B31 is inserted without any issues, but I can't get the comment to scale by the values in cells I44 and K44.
Any help would be appreciated, as I am not really sure what I am doing wrong. Thanks in advance,

Eric
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Try...

Code:
Rng.Comment.Shape.ScaleWidth Factor:=Sheets("Metrics").Range("I44"), RelativeToOriginalSize:=msoFalse, Scale:=msoScaleFromTopLeft
Rng.Comment.Shape.ScaleHeight Factor:=Sheets("Metrics").Range("K44"), RelativeToOriginalSize:=msoFalse, Scale:=msoScaleFromTopLeft

Hope this helps!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,383
Messages
6,119,196
Members
448,874
Latest member
Lancelots

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