Kumar Shanmugam
Member
Hi I am trying to use below code but I am getting error 438
Objective. is to automate display of pictures using comments with vba. I am getting images displayed against C2 cell but I cannot adjust its scale height and width.
VBa code:
Sub showPic()
For Each cell In Selection
MyPicture = "F:\Pictures_airmore_20180807_074658\" & cell.Value & ".png"
With cell.AddComment
.Shape.Fill.UserPicture MyPicture
.ShapeRange.ScaleWidth.UserPicture MyPicture = 2.92, msoFalse, msoScaleFromTopLeft
.ShapeRange.ScaleHeight.UserPicture MyPicture = 3.22, msoFalse, msoScaleFromTopLeft
End With
Next cell
End Sub
This is my workbook. Problem is with scale height and width in below vba code. I don't know how to fix it.
Vba code:
Objective. is to automate display of pictures using comments with vba. I am getting images displayed against C2 cell but I cannot adjust its scale height and width.
VBa code:
Sub showPic()
For Each cell In Selection
MyPicture = "F:\Pictures_airmore_20180807_074658\" & cell.Value & ".png"
With cell.AddComment
.Shape.Fill.UserPicture MyPicture
.ShapeRange.ScaleWidth.UserPicture MyPicture = 2.92, msoFalse, msoScaleFromTopLeft
.ShapeRange.ScaleHeight.UserPicture MyPicture = 3.22, msoFalse, msoScaleFromTopLeft
End With
Next cell
End Sub
This is my workbook. Problem is with scale height and width in below vba code. I don't know how to fix it.
Vba code: