+ Reply to Thread
Results 1 to 4 of 4

Replace "ActiveSheet.Pictures.Insert" with "Shapes.Addpicture" and "SaveWithDocument"

  1. #1
    Registered User
    Join Date
    03-17-2018
    Location
    Ro
    MS-Off Ver
    2010
    Posts
    3

    Replace "ActiveSheet.Pictures.Insert" with "Shapes.Addpicture" and "SaveWithDocument"

    Hello, I have little to no experience in righting codes. I have managed to get my hands on the code bellow .
    Function: insert's picture in excel from location

    The problem i have is once I send the file to another user, if he/she will not have an opened connection to the location from were the pictures were inserted , they will get an error instead of the picture. It's something with "ActiveSheet.Pictures.Insert" that requires an established connection to the source, even thow the pictures were inserted in the sheet.

    "Shapes.Addpicture" and "SaveWithDocument" should solve this problem. I`ve tried myself to modify the code with no result.

    Can you please help me ?


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Replace "ActiveSheet.Pictures.Insert" with "Shapes.Addpicture" and "SaveWithDocument"

    Use this method:
    - note that you MUST include all 7 paramaters when using AddPicture
    - AddPicture creates a picture from an existing file
    - AddPicture returns a Shape object that represents the new picture.
    - setting height and width to -1 leaves the size the same as original image

    Please Login or Register  to view this content.
    Last edited by kev_; 03-17-2018 at 10:55 AM.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  3. #3
    Registered User
    Join Date
    03-17-2018
    Location
    Ro
    MS-Off Ver
    2010
    Posts
    3

    Re: Replace "ActiveSheet.Pictures.Insert" with "Shapes.Addpicture" and "SaveWithDocument"

    Thank you. It works.

    Can you please help me with two more things?

    1) I want to replace : picPath = "C:\TestArea\jpg\" with the adresse found in cell B1 and do something like picPath = "B1"

    2) On error don`t show message , write in cell "Unable to Find Photo"

    Thank you

  4. #4
    Registered User
    Join Date
    03-17-2018
    Location
    Ro
    MS-Off Ver
    2010
    Posts
    3

    Re: Replace "ActiveSheet.Pictures.Insert" with "Shapes.Addpicture" and "SaveWithDocument"

    Thank you. It works.

    Can you please help me with two more things?

    1) I want to replace : picPath = "C:\TestArea\jpg\" with the adresse found in cell B1 and do something like picPath = "B1"

    2) On error don`t show message , write in cell "Unable to Find Photo"

    Thank you

+ 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. Replies: 5
    Last Post: 02-05-2019, 12:03 AM
  2. [SOLVED] Column X-Ref list - Sheet1 Col A "pages", Col B:FL "Req" to Sheet2 ColA "req", ColB "page"
    By excel-card-pulled in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-07-2017, 09:30 AM
  3. [SOLVED] VBA help needed to remove all "/" then replace with "-" from cell "B3"and "B5"
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-17-2014, 02:11 PM
  4. [SOLVED] If Not ActiveSheet.Range("A1").Value Like "apple" Then MsgBox "Error"
    By HerryMarkowitz in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-18-2014, 02:16 PM
  5. Method "AddPicture" of object "InlineShapes" failed - but only one 1 computer
    By Alves76 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-20-2013, 10:49 AM
  6. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  7. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM

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