melodramatic
Board Regular
- Joined
- Apr 28, 2003
- Messages
- 187
- Office Version
- 365
- Platform
- Windows
I have a macro that will go thru a folder for our tests, pull all the photos and line them up in order. Everything has worked fine for several years.
Then I did my office365 update Friday. The code died with it.
When I run the macro, I get a Run-time error '1004': The item with the specified name wasn't found.
The error appears at the 2nd line after the 2-line break (I've got it marked to the right) in my coding, as shown below:
Then I did my office365 update Friday. The code died with it.
When I run the macro, I get a Run-time error '1004': The item with the specified name wasn't found.
The error appears at the 2nd line after the 2-line break (I've got it marked to the right) in my coding, as shown below:
Code:
For ListRow = 5 To LastRow
Sheets("jpgList").Select
If Range("C" & ListRow) = "Y" Then
PhotoFile = PhotosFolder & "\" & Range("B" & ListRow)
PhotoOrient = Range("D" & ListRow)
Sheets("PhotoArray").Select
If PhotoOrient = "Landscape" Then
Rows(ArrayRow & ":" & ArrayRow).Select
Selection.RowHeight = 342
Range("A" & ArrayRow).Select
ActiveSheet.Pictures.Insert(PhotoFile).Select
ActiveSheet.Shapes.Range(Array("Picture " & PhotoNum)).Select '<<------ THIS IS WHERE MY ERROR POPS UP
Selection.ShapeRange.Line.Visible = msoFalse
Selection.ShapeRange.IncrementRotation 0
Selection.ShapeRange.LockAspectRatio = msoFalse
Selection.ShapeRange.Height = 340
Selection.ShapeRange.Width = 456
Selection.ShapeRange.IncrementTop 1.5
End If
If PhotoOrient = "Portrait" Then
Rows(ArrayRow & ":" & ArrayRow).Select
If ArrayRow > 2 Then
ActiveWindow.SelectedSheets.HPageBreaks.Add Before:=ActiveCell
End If
Selection.RowHeight = 130
ArrayRow = ArrayRow + 1
Rows(ArrayRow & ":" & ArrayRow).Select
Selection.RowHeight = 342
Range("A" & ArrayRow).Select
ActiveSheet.Pictures.Insert(PhotoFile).Select
ArrayRow = ArrayRow + 1
Rows(ArrayRow & ":" & ArrayRow).Select
Selection.RowHeight = 130
ActiveSheet.Shapes.Range(Array("Picture " & PhotoNum)).Select
Selection.ShapeRange.Line.Visible = msoFalse
Selection.ShapeRange.LockAspectRatio = msoFalse
Selection.ShapeRange.Height = 340
Selection.ShapeRange.Width = 456
Selection.ShapeRange.IncrementRotation 90
Selection.ShapeRange.IncrementTop 70
End If
ArrayRow = ArrayRow + 1
Rows(ArrayRow & ":" & ArrayRow).Select
Selection.RowHeight = 28.5
Range("B" & ArrayRow).Select
ActiveCell.Value = PhotoNum
Range("A" & ArrayRow).Select
ActiveCell.Formula = "=VLOOKUP(B" & ArrayRow & ",Table1,6,FALSE)"
ArrayRow = ArrayRow + 1
PhotoNum = PhotoNum + 1
End If
Next ListRow