drom
Well-known Member
- Joined
- Mar 20, 2005
- Messages
- 543
- Office Version
- 2021
- 2019
- 2016
- 2013
- 2011
- 2010
- 2007
Hi and thanks in advance!
I am inserting a image located in a webside in a cell
The picture goes perfect, but if for any reason I increase the column Width or the row height, the picture keeps the previous size, does no resize accordingly
What am I missing ?
I am inserting a image located in a webside in a cell
VBA Code:
dim rCell as range: Set rCell=ActiveCell
dim wURL as string: wURL="https://logodix.com/logo/701195.jpg" 'Just for this eg
Set PIC = Nothing: Set PIC = ActiveSheet.Pictures.Insert(wURL)
If PIC Is Nothing Then
xPicWrong = xPicWrong + 1
Else
xPicOK = xPicOK + 1
With PIC.ShapeRange
.LockAspectRatio = msoFalse
.Top = rCell.Top
.Left = rCell.Left
If .Width > rCell.Width Then
.Width = rCell.Width * 5 / 7
.Left = rCell.Left + (rCell.Width * 1 / 7)
End If
If .Height > rCell.Height Then
.Height = rCell.Height * 5 / 7
.Top = rCell.Top + (rCell.Height * 1 / 7)
End If
End With
PIC.Placement = xlMoveAndSize
End If
End If
The picture goes perfect, but if for any reason I increase the column Width or the row height, the picture keeps the previous size, does no resize accordingly
What am I missing ?