Closed Thread
Results 1 to 2 of 2

VBA to cut image file path from word bookmark and replace with inserted image

  1. #1
    Registered User
    Join Date
    05-10-2018
    Location
    Tasmania, Australia
    MS-Off Ver
    2010
    Posts
    2

    VBA to cut image file path from word bookmark and replace with inserted image

    Hi all,

    I have an excel sheet with a button that is inserting the contents of a cell into a word document at a specified bookmark. Each cell in the excel sheet contains the file path of an image i.e. s:\image.png or s:\image2.png. I currently have ten word bookmarks each referencing a separate cell ("logo1"=D5, "logo2"=D6 etc); and the contents of each cell change based on a drop down in the worksheet (each of the 10 cells could reference one of 80 image file paths, depending on drop down selection).

    Essentially the vba script that I am running results in the filepath being displayed as text at the word bookmark; whereas I would like the image belonging to the file path to be displayed.

    I'm thinking the cleanest way would be to stick with what I have in terms of the excel vba and then have a button in word that converts the file path into an inserted image. Essentially I am after a vba that finds the text inserted at the bookmark that starts with 's:\' and ends with '.PNG' (given what is between those items will vary), cuts this text out and then replaces it with an image that matches the file path in the bookmark text.

    -My bookmarks are named 'logo1', 'logo2' etc
    -images all have a file path of 's:\ *variable* .PNG'
    -the text copied from excel and into each bookmark is named exactly the same as the file path of each image I want in its place i.e the text at bookmark 'logo1' is s:\pic1.PNG and should be replaced with an image located at s:\pic1.PNG


    Any help greatly appreciated!!!
    Thanks!

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,851

    Re: VBA to cut image file path from word bookmark and replace with inserted image

    Welcome to the Forum, unfortunately this is a duplicate post and as such will now be closed, you may continue in your other thread. Please read our forum rules that you agreed to when you joined.

    Thread Closed.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA to cut image file path from word bookmark and replace with inserted image
    By JayRay1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2018, 07:31 PM
  2. Export image from Excel to Word bookmark
    By littlecabbage336 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-03-2015, 01:49 PM
  3. [SOLVED] How to apply Image borders to an image that my excel vba userform pastes in a word doc?
    By CaptainCool in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-11-2014, 05:40 PM
  4. Replies: 2
    Last Post: 07-02-2013, 03:36 PM
  5. [SOLVED] Insert jpg image from file path to image frame
    By SAsplin in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-27-2012, 10:12 AM
  6. Specify image size when loading into word bookmark
    By ChrisMattock in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-14-2007, 03:01 PM
  7. Load image into word bookmark - or another solution?
    By ChrisMattock in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-11-2007, 02:50 PM

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