chrisjaguar
New Member
Hello,
i have a macro that has worked as it is now since 10 years without any issue.
Since yesterday me and 2 other colleagues get this message when executing the code:
This error is shown every time when there is no file with this name in the folder that is searched.
But in the last ten years with the same code what happened was that this line just didn't get a picture, no error was shown and the code continued untill the end of the loop.
since yesterday the error above is shown, it doesn't seem to be a VBA error.
and if it was shouldn't it be captured by the "on error resume next"?
I don't understand at all what happens and how it could be solved...
Anybody any ideas?
This is the code:
thanx a lot !
Kind regards,
Chris
i have a macro that has worked as it is now since 10 years without any issue.
Since yesterday me and 2 other colleagues get this message when executing the code:
This error is shown every time when there is no file with this name in the folder that is searched.
But in the last ten years with the same code what happened was that this line just didn't get a picture, no error was shown and the code continued untill the end of the loop.
since yesterday the error above is shown, it doesn't seem to be a VBA error.
and if it was shouldn't it be captured by the "on error resume next"?
I don't understand at all what happens and how it could be solved...
Anybody any ideas?
This is the code:
Code:
Sub FotoToevoegen()
Application.ScreenUpdating = False
Range("a1").EntireRow.Insert
Range("B1").EntireColumn.Insert
Range("B1").ColumnWidth = 19
ActiveSheet.Rows("3:10000").RowHeight = 70
Const Afb_map = "\\SRV006pomax.pomax.com\data\PomaxFotos\FotosResult\100x100\"
myarray = WorksheetFunction.Transpose(Range("A3", Range("A" & Rows.Count).End(xlUp)).Value)
ActiveSheet.Protect False, False, False, False, False
If Not IsArray(myarray) Then Exit Sub
On Error Resume Next
lRow = 3
For lLoop = LBound(myarray) To UBound(myarray)
On Error Resume Next
Set sShape = ActiveSheet.Shapes.AddPicture(Afb_map & myarray(lLoop) & ".jpg", msoFalse, msoCTrue, _
Cells(1, 2).Left + 9, Cells(lRow, 2).Top + 8, 80, 60)
On Error Resume Next
lRow = lRow + 1
Next lLoop
Dim xPic As Picture
On Error Resume Next
For Each xPic In ActiveSheet.Pictures
xPic.Placement = xlMoveAndSize
Next
Application.ScreenUpdating = True
End Sub
thanx a lot !
Kind regards,
Chris