Hi all,
I have a macro that fills a textbox with a picture from a URL and aligns the textbox to a cell.
The issue I have is that the alignment is not 100% exact so that all the textboxes are created row by row they start to align out of sync with the cells (see image).
This never used to be the case when using an older version of excel but is now an annoying issue.!!
Has anyone else noticed this? Can somebody help me with this so that the textboxes align exactly with the cells?
Thanks,
Lewis
I have a macro that fills a textbox with a picture from a URL and aligns the textbox to a cell.
VBA Code:
Sub FillPic()
Dim i As Long, URL As String
Dim oTextBox As TextBox
For Each oTextBox In ActiveSheet.TextBoxes
oTextBox.Delete
Next oTextBox
i = 2
Do While Len(ActiveSheet.Cells(i, 1).Text) > 0
URL = ActiveSheet.Cells(i, 1).Text
With ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 100, 100, 200, 50)
.Left = ActiveSheet.Cells(i, 2).Left
.Top = ActiveSheet.Cells(i, 2).Top
.Height = ActiveSheet.Cells(i, 2).Height
.Width = ActiveSheet.Cells(i, 2).Width
.Fill.UserPicture URL
On Error Resume Next
End With
i = i + 1
Loop
End Sub
The issue I have is that the alignment is not 100% exact so that all the textboxes are created row by row they start to align out of sync with the cells (see image).
This never used to be the case when using an older version of excel but is now an annoying issue.!!
Has anyone else noticed this? Can somebody help me with this so that the textboxes align exactly with the cells?
Thanks,
Lewis
Last edited: