Dear All,
Hope you all are well!!
Subject: I am getting an error to importing images (An error occurred while importing this file. D:\A Suresh 2022 New Data\2022 New Data_Ariane_Suresh\Low_Resoution_Images/AMKARN0000.png)
Below is the code which i am Using.
>>> use code - tags <<<
Hope you all are well!!
Subject: I am getting an error to importing images (An error occurred while importing this file. D:\A Suresh 2022 New Data\2022 New Data_Ariane_Suresh\Low_Resoution_Images/AMKARN0000.png)
Below is the code which i am Using.
>>> use code - tags <<<
Code:
Private Sub CommandButton1_Click()
Dim pictname As String
Dim pastehere As Range
Dim pasterow As Long
Dim x As Long
Dim lastrow As Long
lastrow = Worksheets("sheet1").Range("B1").CurrentRegion.Rows.Count
x = 2
For x = 2 To lastrow
Set pastehere = Cells(x, 1)
pasterow = pastehere.Row
On Error Resume Next
Cells(pasterow, 3).Select 'This is where picture will be inserted
pictname = Cells(x, 2) 'This is the picture name
ActiveSheet.Shapes.AddPicture Filename:="D:\A Suresh 2022 New Data\2022 New Data_Ariane_Suresh\Low_Resoution_Images \" & pictname & ".png", LinkToFile:=msoFalse, SaveWithDocument:=msoCTrue, Left:=Selection.Left + 8, Top:=Selection.Top + 8, Width:=50#, Height:=50#
Next
MsgBox ActiveSheet.Shapes.Count - 1
End Sub
Last edited by a moderator: