Good afternoon,
I have a spreadsheet, where I need to automatically include images. I would like to know if there is any way to create a macro, where you merge the Reference and the color (reference & color) and search in a certain folder the photo related to that code.
Ex:
Inthemacroitispossiblethatwhenyoudonothaveaphotointhefoldernamedwith(reference&colorex:60557000156)youcanskipitandcontinueinsertingphotosintothenextones?
Macroalreadyexists:ThemacroIuseinothermaterialstosearchforimagesisthisbelow,howeveritneedstoberepeatedforeachimageIneed,previouslytherewereamaximumof20images,howevernowforeachpageareatleast78imagesandeachexceltabhasamaximumof6pageswhichresultsinapproximately468images,soI'mlookingforamoresummarizedmacro;
SubMacros2()CallImagem1CallImagem2CallImagem3'...CallImagem20EndSubSubImagem1()Range("B11").Select 'This is where picture will be inserted
Dim picname As String
picname = Range("A6") 'This is the picture name
ActiveSheet.Pictures.Insert("\storage\Img_Systextil\PROJETO LUNENDER\Fotos RPN\Inverno 2018\" & picname & ".JPG").Select 'Path to where pictures are stored
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This resizes the picture
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
With Selection
.Left = Range("B11").Left
.Top = Range("B11").Top
.ShapeRange.LockAspectRatio = msoFalse
.ShapeRange.Height = 150#
.ShapeRange.Width = 150#
.ShapeRange.Rotation = 0#
End With
Range("A10").Select
Application.ScreenUpdating = True
Exit Sub
ErrNoPhoto:
MsgBox "Unable to Find Photo" 'Shows message box if picture not found
Exit Sub
Range("B20").Select
End Sub