+ Reply to 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.


    Any help greatly appreciated!!!
    Thanks!

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

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

    Cross-posted at: http://www.vbaexpress.com/forum/show...ge-at-bookmark

    Please read Excel Forum's Cross-Posting policy in rule 8: http://www.excelforum.com/forum-rule...rum-rules.html
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

+ 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. 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
  2. [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
  3. Replies: 2
    Last Post: 07-02-2013, 03:36 PM
  4. [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
  5. getting file path of image
    By mrjonesgl in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-22-2010, 10:47 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