This message appears whenever I attempt to insert an image that does not exist. This I would expect except until recently it did not display. I would like to know how I can stop this error message from being displayed. I apologize as I do not know how to include code in a message so I will copy and paste.
Here is a snapshot of the output.
Previously, I simply added the "Image Not Found" in the merged area reserved for the image. Thanks for any help you might provide. I am wondering if something has changed with the process of handling shapes or images?
I hope I have done this properly.
VBA Code:
If Pref_DC_Special = "Y" Then
Image_Column1 = Range("A" & Control_Row_Value - 3)
Image_Column2 = Range("B" & Control_Row_Value - 1)
Range("A" & Control_Row_Value - 3 & ":" & "B" & Control_Row_Value - 1).Merge
Range("A" & Control_Row_Value - 3 & ":" & "B" & Control_Row_Value - 1).Select
...
Selection.Value = ""
Control_Row_Height = Selection.RowHeight 'Save to reset original height if no image
Image_Width_Cell = Selection.Width
Image_Height_Cell = Selection.Height
UTY_Ans = Pref_Image_Directory & "\" & ToShow_Img & ".JPG"
Debug.Print UTY_Ans
On Error GoTo Process_Image_Err
' Application.ScreenUpdating = False
' Application.DisplayAlerts = False
ActiveSheet.Pictures.Insert(UTY_Ans).Select NOTE: This code looks a bit off but has not been changed and works for all "found" images.
' Application.ScreenUpdating = True
' Application.DisplayAlerts = True
On Error GoTo 0
Selection.ShapeRange.Height = Image_Height_Cell - 2
If Selection.ShapeRange.Width > Image_Width_Cell Then Selection.ShapeRange.Width = Image_Width_Cell - 2
' ======================================================
' Code below is to get info to center the image in its space
' ======================================================
Image_Width_Image = Selection.ShapeRange.Width
Image_Height_Image = Selection.ShapeRange.Height
If Image_Height_Image + 5 > Control_Row_Height Then
Image_Height_Cell = Image_Height_Cell + 5
Rows(Control_Row_Value).RowHeight = Image_Height_Cell
End If
Image_Position_Right = (Image_Width_Cell - Image_Width_Image) / 2
Image_Position_Down = (Image_Height_Cell - Image_Height_Image) / 2
Selection.ShapeRange.IncrementLeft Image_Position_Right
Selection.ShapeRange.IncrementTop Image_Position_Down
Exit Sub
...
Previously, I simply added the "Image Not Found" in the merged area reserved for the image. Thanks for any help you might provide. I am wondering if something has changed with the process of handling shapes or images?
I hope I have done this properly.
Last edited by a moderator: