I'm currently importing product images from a database into Excel using the Visual Basic code below:
'Updateby Extendoffice 20161116
Dim Pshp As Shape
Dim xRg As Range
Dim xCol As Long
On Error Resume Next
Application.ScreenUpdating = False
Set Rng = ActiveSheet.Range("A1:A500")
For Each cell In Rng
filenam = cell
Set Pshp = Selection.ShapeRange.Item(1)
If Pshp Is Nothing Then GoTo lab
xCol = cell.Column + 1
Set xRg = Cells(cell.Row, xCol)
.LockAspectRatio = msoFalse
.Width = 100
.Height = 100
.Top = xRg.Top + (xRg.Height - .Height) / 2
.Left = xRg.Left + (xRg.Width - .Width) / 2
Set Pshp = Nothing
Application.ScreenUpdating = True
It works fine the only problem is I have to download 100's of images at a time and this script names all the images "image 1" and so on to 500 at times.
Does anyone know how I can get the script to name each image with the product code the cell next to it? Essentially I have the address of the image in column A1...A500 and the corresponding product code in B1...B500. I want it to find the image in A1 and call it the code in B1 and not "image 1".
I'd be really grateful for any help...
Extracting images from a database but named with a specific cell content.
Well, it runs right for me, as soon as you place the line back in to name the filename. Not certain what the issue is. Great job as always on this, TrowaD (you know who this is, but I no longer have access)!