+ Reply to Thread
Results 1 to 4 of 4

Embed image as resource and insert into new spreadsheet?

  1. #1
    Registered User
    Join Date
    10-03-2014
    Location
    USA
    MS-Off Ver
    2013
    Posts
    6

    Embed image as resource and insert into new spreadsheet?

    Hello,

    If anyone can help me with this problem I would appreciate it.

    I am working on macro script that imports header images that are located in the same directory as the spreadsheet. The code for this works.

    The problem with this, however, is if someone by mistake removes the image folder, or opens the macro when it is in a compressed zip file, it will obviously not be able to import the images.

    Is there a way to add images as resources, like in VB6, in a excel macro? What code would you use to insert the resource into the spreadsheet as an image if so?

    Thanks.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Embed image as resource and insert into new spreadsheet?

    Hi macro2014 and welcome to ExcelForum.com

    Try the following which may help you. They both seemed to work for me in Excel 2003 on a Vista 32 bit system. Anecdotal evidence suggests that 'Pictures.Insert' may not be successful.

    Lewis

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-03-2014
    Location
    USA
    MS-Off Ver
    2013
    Posts
    6

    Re: Embed image as resource and insert into new spreadsheet?

    Thanks for the response.

    Is it possible to add the image as a resource or model though inside the macro script, so that I don't have to use sPathAndFileName = ThisWorkbook.Path & "\" & sTestFileNAME to locate / import it? I am trying to make everything in one macro, instead of having external images.

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Embed image as resource and insert into new spreadsheet?

    The code I provided was intended to provide a one time permanent import of images at design time, with no links to the original images in the destination Excel file.

    I have no experience using the concept of 'resource files' in conjunction with Excel. The only scenario I can think of that would marginally fit your requirements, would be to imbed all the images in an Excel File that is in a protected directory (to prevent accidental file deletion). Each image could have it's own unique name, that could then be permanently imported into your working Excel file (with no link to the source image file).

    I'm sorry I couldn't be of more help.

    Lewis

+ 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. [SOLVED] Embed Image in .xlam and Insert Using VBA
    By nicotob in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-16-2014, 03:49 AM
  2. [SOLVED] Image Embed into a Shape from a URL?
    By bmasella in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-28-2014, 03:18 PM
  3. [SOLVED] Embed image to button using Image control
    By siobeh in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-12-2014, 05:37 PM
  4. Embed Image JPG and Type Over it.
    By WileECoyote in forum Excel General
    Replies: 1
    Last Post: 04-06-2011, 07:52 AM
  5. Embed image in cell
    By sschroeder in forum Excel General
    Replies: 11
    Last Post: 12-16-2009, 03:56 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