mickyflash
Board Regular
- Joined
- Jan 29, 2009
- Messages
- 77
Help!
I have used this code for a couple of years now without any issues, however all of a sudden excel is not liking it and I am not sure what has changed.
Excel uses this code:
to scan through the links on the left and pull the relevant picture on the right however I am getting a red x image can not be found on each row, despite the links being of the correct address and displaying where they should be on the spreadsheet!
How do I get rid of the red X's?
I am also using this code
To display images, but this is now bringing up an error message saying An Error Occoured while Importing this file. with an OK box pop up.
No image is displayed on this occasion, and I have to manually overide the macro by clicking OK.
There are over 500 images per spreadsheet and nothing is importing correctly now, what could have gone wrong?
I have tried updating excel, restoring the file to a previous version, deleting my temp folder, updating my privacy records and going through to see if an excel option has changed but to no avail.
Your my last hope guys. please help!
I have used this code for a couple of years now without any issues, however all of a sudden excel is not liking it and I am not sure what has changed.
Excel uses this code:
VBA Code:
Sub table_pic11()
Dim Pshp As Shape
Dim xRg As Range
Dim xCol As Long
On Error Resume Next
Application.ScreenUpdating = False
Set rng = ActiveSheet.Range("B238:V340")
For Each cell In rng
filenam = cell
ActiveSheet.Pictures.Insert(filenam).Select
Set Pshp = Selection.ShapeRange.Item(1)
If Pshp Is Nothing Then GoTo lab
xCol = cell.Column + 31
Set xRg = Cells(cell.Row, xCol)
With Pshp
.LockAspectRatio = msoFalse
If .Width > xRg.Width Then .Width = xRg.Width * 2 / 3
If .Height > xRg.Height Then .Height = xRg.Height * 2 / 3
.Top = xRg.Top + (xRg.Height - .Height) / 2
.Left = xRg.Left + (xRg.Width - .Width) / 2
End With
lab:
Set Pshp = Nothing
Range("w22").Select
Next
Application.ScreenUpdating = True
End Sub
to scan through the links on the left and pull the relevant picture on the right however I am getting a red x image can not be found on each row, despite the links being of the correct address and displaying where they should be on the spreadsheet!
How do I get rid of the red X's?
I am also using this code
VBA Code:
Public Sub Add_Images_To_Cells9()
Dim lastRow As Long
Dim URLs As Range, URL As Range, shpCel As Range
Dim shp As Shape, N As String
With ActiveSheet
lastRow = .Cells(.Rows.Count, "y").End(xlUp).Row
Set URLs = .Range("y100:y220")
For Each URL In URLs
URL.Offset(0, 5).Select
On Error Resume Next
URL.Parent.Pictures.Insert URL.Value
DoEvents
Set shp = .Shapes(.Shapes.Count)
If Not URL.Offset(, 1) Then shp.PictureFormat.ColorType = 1
Next URL
End With
End Sub
To display images, but this is now bringing up an error message saying An Error Occoured while Importing this file. with an OK box pop up.
No image is displayed on this occasion, and I have to manually overide the macro by clicking OK.
There are over 500 images per spreadsheet and nothing is importing correctly now, what could have gone wrong?
I have tried updating excel, restoring the file to a previous version, deleting my temp folder, updating my privacy records and going through to see if an excel option has changed but to no avail.
Your my last hope guys. please help!
Last edited: