excel - Get Dimensions of Cell Comment Background Image (.Shape.Fill.UserPicture) -
how dimensions of cell comment background image?
i have created comment composed solely of background image using,
activecell.comment.shape.fill.userpicture l_strfullpathofimagepng
i able to,
- select cell.
- run macro resizes comment background image not fuzzy, rather sized pixel pixel.
to need know dimensions of background image.
if know full path of image file created background image, can resize cell comment achieve want:
sub commentresizetofitbackgroundimage() dim l_strfullpathofimagepng string dim l_limagewidth_pixels long, _ l_limageheight_pixels long l_strfullpathofimagepng = "c:\……\backgroundimage.png" 'get width , height in pixels of image inserted getpngdimensions _ l_strfullpathofimagepng, _ l_limagewidth_pixels, _ l_limageheight_pixels activecell.comment.shape '0.75 scale factor arrived @ empirically 'and true machine .width = l_limagewidth_pixels * 0.75 .height = l_limageheight_pixels * 0.75 end end sub
however, existing comments no longer have valid image file read, need dimensions of background image.
.comment.shape.scaleheight 1, msotrue
looks promising, fails error "the relativetooriginalsize argument applies picture or ole object".
.comment.shape.fill.type
= msofilltype.msofillpicture
; indeed have picture, , not solid background, gradient, pattern, or texture; don't know compiler complaining about.
lastly, evidently, .comment.shape.fill.pictureeffects
doesn't work comments.
Comments
Post a Comment