Inserting image files from a directory specified by text string
Closed
MattRNR
Posts
8
Registration date
Sunday April 3, 2016
Status
Member
Last seen
April 18, 2016
-
Apr 3, 2016 at 08:23 AM
MattRNR Posts 8 Registration date Sunday April 3, 2016 Status Member Last seen April 18, 2016 - Apr 18, 2016 at 07:46 AM
MattRNR Posts 8 Registration date Sunday April 3, 2016 Status Member Last seen April 18, 2016 - Apr 18, 2016 at 07:46 AM
Related:
- Unable to get the insert property of the pictures class
- Unable to authorize tiktok - TikTok Forum
- Unable to complete request ✓ - Facebook Messenger Forum
- Unable to ping computer on same network - Guide
- Unable to complete request on messenger app - Facebook Messenger Forum
- How to insert picture in word without moving text - Guide
4 responses
G'Day Matt
With the Folder path in Cell A1 and the filename's of the pictures in cells A2, A3 etc. this will insert each picture into the adjacent cell B2, B3 etc.
Before to size column B and the rows for each picture before running the macro otherwise scaling doesn't seem to work after the fact.
With the Folder path in Cell A1 and the filename's of the pictures in cells A2, A3 etc. this will insert each picture into the adjacent cell B2, B3 etc.
Before to size column B and the rows for each picture before running the macro otherwise scaling doesn't seem to work after the fact.
Sub insertpictures() LR = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row For myRow = 2 To LR PicturePath = Range("A1").Value & "\" & Range("A" & myRow).Value With ActiveSheet.Pictures.Insert(PicturePath) With .ShapeRange .LockAspectRatio = msoTrue .Width = Cells(myRow, 2).Width .Height = Cells(myRow, 2).Height End With .Left = ActiveSheet.Cells(myRow, 2).Left .Top = ActiveSheet.Cells(myRow, 2).Top .Placement = xlMoveAndSize End With Next myRow End Sub
Apr 6, 2016 at 05:42 AM
Alas I can’t seem to get this to work, I have paste the code into the ‘this workbook’ excel object and then run the macro however I receive an error box with the number 400 in it.
I’m certain this would work if I had any idea what I was doing, have you any idea what exceptionally obvious thing I am doing wrong?
Could I perhaps amend my initial question slightly?
If I were, alternatively, to have the full ‘picture path’ name in one cell (say A1) as well as a destination cell (say B1) both specified in a code, could this code be used to paste the image corresponding to that path in that destination cell?
It may be worth mentioning I'm designing a system to make price tags and I want to use this code to take the barcode image from a file of barcode images and past it directly into the template on the sheet
Cheers for any advice you can provide
Regards
Matt