+ Reply to Thread
Results 1 to 69 of 69

Use code to insert multiple pictures from list based on a call value

  1. #1
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Use code to insert multiple pictures from list based on a call value

    Hi all,

    Thanks in advance for help.

    I am trying to help my sister create a mailing list containing names and images which she changes constantly. The list involves 3 data fields (a name, a size, a price), plus a picture. In the sheet attached the sheet (Flower-Letter) will get PDFed and sent out. What I would like to do is have the code look for the Name (currently a, b, c , d, e etc) and then place the image of the relevant flower found on the sheet "Flowers - List" in the cell 4 rows below (formatted to fit it)

    The Flowers-Letter page is fed from the input sheet where in cells F6-F43 the user will update the list of relevant items for that newsletter (these will also be pulled from the list to ensure they are exact matches). These are then put into alphabetical order and fed onto the Letter sheet. So would need to code to go through the names shown on the Letter Sheet (B4, D4, B10, D10 etc) and check each image corresponds (or if easier deletes all images minus logo at top and adds new relevant ones). Ideally images would be aligned to top left of their prospective cell too (the images will all be put into list exactly the same size and ratio). There will eventually be 4 from pages / lists but if I can get one working with help I should be able to modify code across the rest.

    Not sure if this is possible - there is a link below to a thread that is similar but could not get it to work:

    https://www.excelforum.com/excel-pro...ys-method.html

    Have also looked at the linked image option but would require 100s of named ranges as far as I can understand.

    Any advice would be much appreciated.

    Thanks,

    Alex
    Attached Files Attached Files

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    Hi Adam,
    Will all the relevant pictures be in the 'Flowers-List' sheet? You know you could even have a list of picture files on the system and import those so that it keeps the file-size down to a minimum.
    I'll read you explanation wit more attention and i'll take a look tomorrow during the day since it's almost midnight here and see if I can come up with a quick and simple solution.
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73
    Quote Originally Posted by Keebellah View Post
    Hi Adam,
    Will all the relevant pictures be in the 'Flowers-List' sheet? You know you could even have a list of picture files on the system and import those so that it keeps the file-size down to a minimum.
    I'll read you explanation wit more attention and i'll take a look tomorrow during the day since it's almost midnight here and see if I can come up with a quick and simple solution.

    Hi thanks for replying! I was actually just watching a YouTube video doing it from a file structure and agree that would make more sense- if the code could somehow be started by a button and go through each name rather than be driven by a change event that would be perfect. THanks again!

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    Hi, I suggest you take a look at the post by MyVB_polly
    More or less the same
    I'll try later today to see what I can offer, I workd on this one too

  5. #5
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    Hi, yes that does look very similar. I had a look through the code though and it is a bit beyond me (have very basic VBA understanding) - from what I can understand the code is split into a few different phases - would be happy with one that just wiped the existing pics (except logo) and replaced with new pics if thats easier. The folder macro sounds very useful to as trying to do this for someone else so might help them to move it over - but I cant actually see a file location address in the code?

  6. #6
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    It's a variable that is set in one of the pages, I nevre had-code things like printers, file locations, filenames in code since these are prone to change.
    Basic rule in programming is to NEVER hard-code values that are system or user dependent
    Like I said, I'll work with the file you attached and use the idea of the file I worked on.
    I won't be able to start on it 'til after lunch (here)

  7. #7
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    You cal so check out a posy by anilpatni1234 in May

  8. #8
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    That one does seem very similar, think with a starter code I might be able to error check and edit my way to something that works!

  9. #9
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    I’m testing my modifications and will post soon

  10. #10
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    I've attached a modified file, I'll have to explain the idea but it's late.
    For now, I added two new worksheets, 'Admin Sheet' and 'Catalog - Flowers'
    When the file is opened it will take you to the Catalog - Flowers sheet and since the image folder is unknown on your system it will prompt you to select or create a folder and select it.
    This is all stored in Admin Sheet. Leave the top row intact please
    Column B2 through B5 will contain the file paths, if incorrect or empty the cell is coloured red
    I extracted four images and saved them as gif files and have placed these in the Flowers zip file
    The other is the Excel file
    I suggest you unpack the zip files in the folder where you will place or already have the mailing list.
    The Flowers will be extracted to a sub-folder named Flowers and in there the image files.
    I used the gif extension in the macros, but if you have bmp or jpg files then you will have to change that, but for this test the gif will work.

    In the Catalog - Flowers sheet.
    Column B contains the name of the flower (no file extension) and the image file should have the same name to be found.
    After you have entered the correct name you can double-click the cell with the name in column B and the image will be place in column E as a thumbnail
    Right click column B and you will the full size image in a user form just to see it.
    So far this is what I did.

    The further idea would be to have dropdown lists in the sheets were the flowers are selected for the letter and the full size picture is then retrieved for the letter
    But that's for later. I'm off to bed now.

    I'm sure there will be many questions but I'll answer them all
    I attached one of the images separately as thumbnail
    Attached Images Attached Images
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    Thanks for this Keebelah - sorry it took you until late. Looking through the code Ive had a couple of exceptions on locating folder but looking online it’s because I am mac user so will ignore until can test on PC - could we change to look for file when clicked but not on startup to avoid immediate error.

    Re-process, we don’t need the images in the catalog sheet if they are coming straight from the computers files, they were in the Flower - List sheet as had planned to look them up but this method makes that unnecessary. The plan would be for Flower-List to hold a comprehensive list of all flowers (either Flowers-List or Catalog - Flowers as current duplicates) with identically names jpg files , so they can be recalled in the Flowers-Input Sheet - F6:F43 - the point of this sheet is to ensure that when they go to the Letter sheet they are in alphabetical order. Would it be possible to set the code to go through the range of cells with names in Flowers-Letter (I have listed this range in the Admin sheet if it helps) and basically on a button press, clear images except logo then go if first on range not blank, add image onto cell 4 rows below, then next in range etc. If no image found tell user to check file exists as per current code, if blank do nothing and end code as there should be no gaps (rather than initiating the find and insert code on a double click on the catalog sheet).The cells will be blank if no value is chosen on the input sheet.

    Then we might not need code on each sheet, but just one module linked to a button which the user can press once they’ve completed the input sheet - this way I think I will have a better chance of being able to walk it through step by step, but also duplicate for the other sheets. This way the user could add names in input sheet (assuming list is all up to date), then go to Letter sheet where list will show alphabetically, and press button to show images.

    I have also uploaded the 4 images in the size and format they’ll be saved (jpg).

  12. #12
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    Attachments here
    Attached Files Attached Files

  13. #13
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    I’m not at my system now but will check later this afternoon
    You can remove the line searchfolders or like that in the thiswokbook workbook_open event
    Okay, understanding that catalog and list are the dame nut iT was just an idea, i’ll read what you wrote.
    It should all work on a Mac as well, which Mac office version?

  14. #14
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    Ok thanks will look, its the new system but I think it just requires a different command to open the dialog box which is what I assume it is trying to do. Found this link which I figured might be the reason:

    https://stackoverflow.com/questions/...-ported-to-mac

  15. #15
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    You can also google Ron de Bruin’s site also has sample code for Mac and the differences great site for many things as well as the ribbon too

  16. #16
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    I'll come up with my idea and approach, maybe that'll help and maybe even make it simpler with the same result, letters (as PDF)

  17. #17
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    Hi, I've come up with idea and am working it out, will upload asap, just some tests and explaining to add
    The folder selection is due to the \ in the vba code

    Change this

    Please Login or Register  to view this content.
    to this and that should solve it.

    Please Login or Register  to view this content.

  18. #18
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    Good morning Adam,
    Just to tell you that I haven't forgotten you and that I ran into some time issues and did not complete what I had in mind,
    Still working on it and will update asap.

  19. #19
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    Hi,
    No problem, thanks for continuing to work on it! Look forward to trying it.

  20. #20
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    Hi,
    No problem, thanks for continuing to work on it! Look forward to trying it.

  21. #21
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    Hi there, just wondering if you have managed to make any progress, or if there is a starter code I could try to work on? Thanks!

  22. #22
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    At least for Flowers it is starting to look good, once I have that sorted out it will work for the other categories too.
    I've attached what I have so far as well as the sub folders and images I'm using.
    I suggest you place the file in a specific folder and the subfolders in this same folder
    The file will open with a splashscreen which dissapeears after initializing (+/- 5 seconds) and the Catalog sheet will open with a menu floating.
    I'll have to write the 'manual' but that hasn't come so far yet.
    If you select Flowres in the menuç comboox you'll get some extra buttons and select the Flowers - Input button to show the for for the input list.
    I do NIT use the Flowers - List or the other xxxx - List files for that matter.
    All images are read from the catalog sheet, right click column B to viesw the image (is also to be used to edit but not yet completed)
    Right click the first empty row in column B to add a new image and category
    Hope this all works, it does here
    Attached Files Attached Files

  23. #23
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    The EXPORT PDF works, but I haven't implemented the part that inserts the image in the letter, so just the name and size and price. sorry for that
    Once you inserted the names in the Flowers Input then the Latter is filled with the text parts (your formulas) and you press the export button an export file will be created in the apps folder named Flowers-Week-??.pdf
    The week can be changed with the same image select form

  24. #24
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    One more, the 'NoImgae.jpg' must also be placed in the app folder, not in the subfolders, you can remove it form these sub-folder

  25. #25
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    Hi, this all looks really good but my only concern is that as the code gets more and more complex it will get harder for me to work out or fix in future / add anything to get it going. It does seem to function well at the moment though. However if we need to we are quite happy selecting the flowers from the list on the input sheet, it is adding the images that takes the most amount of manual time so the main piece of code we are looking for is to write just places the images in the correct cell (4 down from the name) on the letter sheet. Is there anyway we could try to get this part working first and then maybe look at the auto-populating later if you have the time and inclination?

  26. #26
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    The code is in plcae, just the placement is missing. Will work that out and that part will be fixed too.
    I'm waiting for a fridge delivery, but once it's in and installed I'll have the time

  27. #27
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    ok great thank you

  28. #28
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    Okay, I made some changes and maybe it's too much.
    I eliminated the xxxx - List sheets and just left the xxxx - input and the xxxx - Letter.
    There is an extra button on the Catalog sheet that will list all the missing image names found in the sub-folders all you need to do is complete the size an price
    Once this is done you can open the menu select the category and then the xxxx - Input to select the plants for the input list.
    This updates the Letter sheets.
    In the letter sheets there are two buttons, one is refresh and that will tun through the names and place the images
    The other creates the PDF file
    I've attache the new Excel app and a PDF sample, the code automatically takes care so that only the pages with data are exported.
    I do however have to fine-tune the layout, I see that page two starts too high that means the top rows of a new page have to be a little higher. will do so tomorrow

    There is also a macro that can be run if you add a new category that will create the input and letter sheets.
    There is a BLANK - input and a BLANK - Letter that is used as template
    Attached Files Attached Files

  29. #29
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    Hi Adam,
    I started writing a manual explaining the works step-by-step with screenshots and the ideas behind it.
    Also this “final” version has some additional functionality which comes in handy and makes manual changes obsolete
    Hope to complete it by Sunday
    Also goto the page setup working

  30. #30
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    Thanks for this. This is looking great and seems to be working well. The file adding functionality is a great idea! Cant say I have any idea how it all works now though!?
    Couple of small things:
    - can we add the logo to the letter sheet and keep it there - the macro seems to reduce the quality of the image a lot? (full size included in attached file)
    - For the formatting, the letter sheet in the attached file is formatted exactly how we want it. Basically the first 2 rows are the headers that need repeating then the pages are split by exactly 12 rows - can we set the code to automatically divide the pages by 12 rows and find the last relevant page (then the formatting shouldn’t get messed up)?
    Attached Files Attached Files

  31. #31
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    Meant to say can we just format paint the letter sheet from the attached file onto your functioning file?

  32. #32
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    Got it, let me work it out some more

  33. #33
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    Well, I got the page setup and logo and everything nice and running as I understood you.
    It was a little more than just format and paint, I didn't get to the manual but the Admin Sheet is the sheet that takes care of things like this.
    I did add the option in the admin sheet to select another pdf output folder for the pdf files.
    Double click B2 and you can select another folder for the export location. Now it's exported in the same folder as the application.
    It's version 1.4 now and I also attached a PDF export sample
    The export is formatted automatically to the max of sheets as there are images with a max of 7 pages.
    I'm off to a late bed now
    Attached Files Attached Files

  34. #34
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    - Selecting new PDF folder:

    Error: Object Variable or with block variable not set

    Line at which it fails:

    With fldr
    .Title = "Select " & IIf(Len(Trim(tMessage)) > 0, tMessage, "Image Folder")


    - Sometime the buttons on the external menu pop up don’t show (only the drop down downs - not the filter buttons or drop down), closing and relaunching menu doesn’t fix, have to close excel and relaunch it to get them to show up

    - Is it possible for the menu to sit behind other open windows or is that just an Excel thing that it always sits on top when you go to another application?
    - Minor formatting, but the thick blue line at the very top of each page should be in grey as in attached PDF - have looked to change but the formatting doesn’t seem to be in the sheet? Is it being added by macro?
    - Just to check one thing, when the file is closed and reopened that the catalog doesn’t refresh? It will take a lot of time to add all the costs / sizes manually and these want to ensure no code accidentally deletes these?

  35. #35
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    Tested it this morning and it seems to work really well - Thank you so much for doing all this - no idea how it all works but it seems to be running very efficiently. Have a few comments, (now above sorry as pasted the wrong one in first!).
    Attached Files Attached Files

  36. #36
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    Sorry forgot to add one last thing, if possible can the PDF creator add this final page each time it generates as the last page? Can just be hidden somewhere in background as long as we can access to edit details when needed. If complicated we can do it manually so don't worry.
    Attached Files Attached Files

  37. #37
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    Strange am on-the-road Will look into it and answer your questions

  38. #38
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    Strange about the With fldr ....
    I don't know why you didn't get the error earlier.
    There seems to be a problem with the References that you can access when you go to the menu item Tools: References
    These are the five that I have referenced, xx.x stands for the Excel version, in my case 16.0
    OLE Automation
    Microsoft Forms 2.0 Object Library this is probably the one that's not working
    Microsoft Office xx.x Object Library
    Microsoft Visual Basic for Applications
    Microsoft Excel xx.x Object Library

    If that one isn't working then the folder select routine won't work...

    I'll check, but there should be an equivalent for MAC Office

  39. #39
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    - In the hope of making it simpler, my sister has narrowed down to just 2 categories:

    “Flowers” & “Foliage, Grasses, Berries & Fruits”

    - We have changed to max of 200 items per sheet (400 across both categories). This now means the letter sheets run up to row 602. I have updated all the reference formula in the Flower - Input and Flower - Letter sheet in the attached and duplicated for the second category. Would it be possible to delete all sheets and just have one for “Flowers” and one for “Foliage, Grasses, Berries & Fruits” as in the attached? These sheets are formatted as planned so hopefully the code can just be applied to these? Happy to delete but not sure if its easier to rename existing or copy the code across?
    - Finally, can the PDF request now just PDF flowers, then foliage etc and then delivery at the end and combine into one PDF?

  40. #40
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    With attachment

  41. #41
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    That's no problem, does this mean that it is possible that you have a LETTER sheet with 50 pages? Not that that's a problem, just to know.
    Combining the PDFs shouldn't be that much of a problem.
    The delivery at the end?
    Did you manage to get the select pdf folder to work with what I posted?

  42. #42
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    I added the pages and used the code to reorganize.
    Page setup is done, I haven't yet looked at combining the PDFs, but... that's for some time late tomorrow
    Attached Files Attached Files

  43. #43
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    One thing I forgot to change is the formula in the flowers I the flowers - input, it pints to flowers - List and that should point to the season catalogue
    I’ll change this when I turn my system on at around 8 p’vl, another one, could you export the input. - list contents to a XDV file and attach it? Or else send me a pm

  44. #44
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    External links corrected and all updated
    Attached Files Attached Files

  45. #45
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    Hi, thank you again for this it all seems to be working amazingly - not sure what you mean here:

    "One thing I forgot to change is the formula in the flowers I the flowers - input, it pints to flowers - List and that should point to the season catalogue
    I’ll change this when I turn my system on at around 8 p’vl, another one, could you export the input. - list contents to a XDV file and attach it? Or else send me a pm" the links seem to be working correctly?

    PDF selection not working on Mac, but will try on users PC today. Not a huge problem as can just manually change the cell input to the location and once set it doenst need changing again.

    I think the only thing left is combining all 3 PDFs but that is very minor.

    Thanks again this is absolutely great!

  46. #46
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    The formulas referred to the other file
    Corrected that in the last attachment

  47. #47
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    Thanks so much for sorting it all, tried again today and all seems to be working really well. Only last thing is if it is possible to autocollate the PDF with Front page (attached), then flowers, then foliage etc, then delivery. If its difficult we can manually collate the PDFs after.

  48. #48
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    with attached

  49. #49
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    take 2 with attachment

  50. #50
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    Attachment wont upload, so even if you can just add a new sheet called front and get the PDF to add at front, we can edit the page to look as planned afterwards

  51. #51
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    No problem, just one thing to be sure. you mention four worksheets, but will is always be the four?
    Maybe once Front, Foliage etc and Delivery? Other times Front, Flowers etc, Delivery
    And then of course all four: Front, Flowers etc, Foliage etc and Delivery?

  52. #52
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    Collating PDF's no problem, here's a blank result with 101 pages no data except the last one, the Delivery Info page
    I generated a name showing the data en time in the format yyyy-mm-dd hhmm, the week number i did not yet include but maybe you or your sister already have a naming convention in mind?
    Will fine-tune it Thursday, Wednesday will be a little difficult for me.
    If your sister already has the list of names and size and description, you can either send me that excel sheet or export that part as csv or text file to import it into the catalog sheet
    Good-night for now
    Attached Files Attached Files

  53. #53
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    Hi, Let me try attaching front page one more time. I think it will always be all 4, front page, then flowers, then foliage etc then delivery details. The middle 2 are the ones that will constantly change in length, the front and back will remain one page each. Re naming convention, maybe just "Flower&Farmer_Wholesale List_Week xx". One additional edit might be to remove the code that selects the code in either flowers or foliage and it just link to the cell of the other to make sure they always match. Thanks again for help!
    Attached Files Attached Files

  54. #54
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    Correction: "One additional edit might be to remove the code that selects the WEEK either flowers or foliage and it just link to the cell of the other to make sure they always match"

  55. #55
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    Okay, let me take a look, won't be til late tonight, have an Excel project this morning and later today we're picking up our daughter from the airport.

  56. #56
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    Okay, I think I got it all:
    The week number will be prompted the moment you press Export PDF button on the Letter sheets
    The name of the PDF file is now: Wholesale_Pricelist 2019 Week38-(2019-09-12-0007).pdf
    Just edit that part if you want it otherwise. The part in the () can server for your control to see when the file was created and at what time to know which one is the most recent, instead of the actual system timestamp

  57. #57
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    This seems to work great - going to do a first test on Saturday morning - will let you know how it goes! Thank you so much for all your help so far!

  58. #58
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    Great, let me know.
    If you still encounter problems with the MAC, I may have the solution, that when the user is working on a MAC he/she will get an input box to enter the folder-name instead of the vba routine with the browser.
    It is however strange that that doesn't work but I do not have a MAC at my disposal to test

  59. #59
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    Just in case there are still issues,
    This is the site I use frequently for Windows but it also has a MAC section, and here there's a sample code to select a folder on a MAC
    https://www.rondebruin.nl/mac/mac017.htm

    If you can test this on the MAC then we could add the the test, if it's a MAC run this macro if Windows the other one, that's not complicated

  60. #60
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    Hi, we did some testing with this today and have had a couple of issues with the PDF function. In the attached the manual file is created by doing a file, save as PDF and the pages are slightly shorter with the front image sitting centrally and the images on the catalogue pages sitting closer to the bottom without the large gap. The auto file is from the PDF macro, and the pages seem to be longer, plus the front image sits too high up. We also dont want the footer or page number on the front page, but after removing the macro seems to replace it again. Not sure how the page formatting is getting set in the macro but ideally it would do any formatting at all so that we can just control that on the pages and it then converts them to PDF. Also is it possible to remove the function that hides all the pages after the PDF as keep having to unhide. The rest of it all seems to work perfectly, just a couple of issues PDFing correctly.

  61. #61
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    with 2 attachments
    Attached Files Attached Files

  62. #62
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    Will take a look, FYI right-click G1 in admin to inhide all sheets right-click again to hide them

  63. #63
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    I would like to point out that the title page you're using is not the same as the one you attached in the 'Mailing front page.xlsx' file, there the letters are white.
    My output does not have the page number i=on this page or the email address, so they're different, and I do not know where the page size differences come from.
    Probably the printer settings on the MAC, these if set incorrectly define the page output when exporting to PDF.
    This is something I cannot correct with the macro and the macro doesn't do anything with the page layout except exclude those without a picture

  64. #64
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    I played around with the file but doesn't really change much, except that the macro button on the Letter sheets does its work and the result maybe for a top margin or so looks good and all fits as it should on the pages.
    I attached the PDF output I got as well as the last file with modifications 1.4.5
    If you read some articles on the internet you'll also see that it's very dependent of the installed printer how the result looks, some printers can star print right at the top of the page so the top margin may be smaller.
    In my case the Brother Inkjet has a wider top margin than an Epson inkjet, and then a lot smaller than an HP inkjet.
    The macro that exports all the sheets is Excel_ExportPDF_Multiple_Sheets
    The macros Excel_ExportPDF and Save2PDF are no used.

    prepare4OutPut prepares the sheets and Set_Letter_PageSetup does take care to make sure the row heights are correct using the range in the Admin sheet

  65. #65
    Registered User
    Join Date
    06-03-2013
    Location
    London, England
    MS-Off Ver
    Excel M365
    Posts
    73

    Re: Use code to insert multiple pictures from list based on a call value

    Ok thanks for that - yes the one youve produced looks perfect - exactly what we are after. The only change was the colour of the logo (just subbed that one in as looks better on the background). Will have to mess about with printer settings etc to get it right this end, but thanks again for all your help - think it looks great!

  66. #66
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    Remember, if you still want to let me help with the part of reading a csv file with the list of flowers input information you might already have and don't want to enter again.

  67. #67
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    Hi Adam, I think we can close this post.
    For those following this post I have attached the final file but without the Delivery info in the Delivery sheet and an empty catalog

  68. #68
    Forum Contributor
    Join Date
    03-08-2018
    Location
    Denmark
    MS-Off Ver
    2016 for Windows
    Posts
    413

    Re: Use code to insert multiple pictures from list based on a call value

    Amazing work Keebellah

  69. #69
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Use code to insert multiple pictures from list based on a call value

    Thank you for the compliment

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Code stall at .Pictures.Insert URL - server not responding?
    By PeterBundeHansen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-16-2017, 12:19 PM
  2. need a vba code to insert pictures with a corresponding file name
    By whan714 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-19-2015, 02:50 PM
  3. insert pictures using a list of picture names
    By bsapaka in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-13-2014, 11:21 PM
  4. Error in code to insert pictures in excelsheet
    By Danielle22 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-30-2013, 01:24 PM
  5. VBA or Macro code to insert pictures in cell
    By thedefense in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-13-2013, 03:47 PM
  6. Insert/Delete Multiple Pictures but 1 or more pictures not available
    By MrNoodles in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-28-2012, 02:10 PM
  7. insert pictures code, needs editing
    By ufopilot3 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-31-2012, 09:48 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1