+ Reply to Thread
Results 1 to 6 of 6

Adding pictures with VBA issue

  1. #1
    Registered User
    Join Date
    10-22-2014
    Location
    Hyde, Manchester
    MS-Off Ver
    2010
    Posts
    79

    Adding pictures with VBA issue

    Hi guys, I need your help once again!

    I have a macro which adds pictures onto a worksheet but it is running into two problems.

    Firstly, on my version of Excel (2013) the pictures are resized correctly and the aspect lock is removed. However, on my colleagues version of excel (2010) it seems to not be disabling the aspect lock. Is there a different command for it in 2010? My code is shown below:

    Please Login or Register  to view this content.
    Secondly, I seem to be having some issues once the picture is inserted. If I look at it on my laptop then the pictures appear but when the file is transferred to another laptop it does not seem to be taking the pictures with it? (I get an error message to say that the link is broken). How do I put the pictures in as pictures rather than just links to the pictures? My code for adding the pictures is shown below:

    Please Login or Register  to view this content.
    You guys have been mighty helpful in the past and I need some more now because I have been scratching my head for ages over this!

    Thanks

    Tom

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Adding pictures with VBA issue

    Hi

    You need to use Activesheet.Shapes.AddPicture rather than Pictures.Insert if you want to control linking versus embedding.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Registered User
    Join Date
    10-22-2014
    Location
    Hyde, Manchester
    MS-Off Ver
    2010
    Posts
    79

    Re: Adding pictures with VBA issue

    Thats brilliant thanks mate, so I now have this

    Please Login or Register  to view this content.
    The with command for ".SelectedItems(1)" is shown below:

    Please Login or Register  to view this content.
    But its giving me an error for having too many arguments. What should the syntax be for taking the selected picture from a dialogue box for "Shapes.AddPicture"?

    Thanks again for the help!

  4. #4
    Registered User
    Join Date
    10-22-2014
    Location
    Hyde, Manchester
    MS-Off Ver
    2010
    Posts
    79

    Re: Adding pictures with VBA issue

    OK after some fiddling I've now got to his which is inserting the picture correctly:

    Please Login or Register  to view this content.
    However, it appears to have locked the aspect ratio by default and I'm not sure how to unlock it with this command?

    Thanks for all your help guys!

  5. #5
    Registered User
    Join Date
    10-22-2014
    Location
    Hyde, Manchester
    MS-Off Ver
    2010
    Posts
    79

    Re: Adding pictures with VBA issue

    Never mind I've now got it all working, the only remaining bug bear is that on my other colleagues laptop which is running office 2007 it seems to be setting the width of the picture to be 0? The picture itself can only be selected when selecting all objects on the page? Anybody have any clue why it might be doing that?

    Thanks

    Tom

  6. #6
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Adding pictures with VBA issue

    Please accept my apologies for the delay but I was away on business for a few days.

    What is the final code that causes the problem in Excel 2007?

+ 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] Adding Pictures From Drop Down List
    By TDeRanger in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-21-2013, 12:49 PM
  2. [SOLVED] adding pictures depending on value
    By wayneg in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-25-2013, 04:08 AM
  3. Cell Distortion Issue With Imported Pictures
    By cat10 in forum Excel General
    Replies: 0
    Last Post: 11-05-2012, 12:26 PM
  4. Link Pictures & Adding Browse Button
    By oldgreg134 in forum Access Tables & Databases
    Replies: 0
    Last Post: 06-29-2012, 05:44 AM
  5. adding pictures to a spreadsheet
    By jamiepullen in forum Excel General
    Replies: 1
    Last Post: 07-16-2007, 04:50 PM
  6. Adding pictures to spreadsheets...
    By cougar12475 in forum Excel General
    Replies: 1
    Last Post: 06-23-2007, 12:52 PM
  7. [SOLVED] Pictures.Visible question (after adding many pictures, they stop disappearing)
    By Abe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-11-2006, 01:35 PM
  8. [SOLVED] adding pictures to an excel file that are on a cd
    By dogisnuts in forum Excel General
    Replies: 1
    Last Post: 04-27-2005, 07:06 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