+ Reply to Thread
Results 1 to 5 of 5

Delete picture macro wont work

  1. #1
    Registered User
    Join Date
    08-15-2016
    Location
    Cincinnati Ohio
    MS-Off Ver
    Professional Plus 2010
    Posts
    2

    Delete picture macro wont work

    I am trying to remove a picture from a sheet but not having any luck. I have a macro that will insert a picture. That works fine. I have an 'undo' button that will go back and delete the picture. This macro does not work. However, if I manually insert the picture and then run the delete macro, the picture is deleted. The picture that is pasted into the sheet using the macro will not delete. The picture pasted into the sheet manual (through the tool bar in excel), will delete. What is the difference between the two pictures where one will delete and the other one will not?

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Delete picture macro wont work

    When you insert a picture with that code its msoShapeType is msoLinkedPicture, not msoPicture.
    Last edited by Norie; 08-30-2016 at 12:56 PM.
    If posting code please use code tags, see here.

  3. #3
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Delete picture macro wont work

    It works for me ince I convert it to msoLinkedPicture.

    I would step through the code and check the shape type.
    Please Login or Register  to view this content.
    before your If statement will do it.
    https://msdn.microsoft.com/en-us/lib.../ff860759.aspx
    Last edited by mikeTRON; 08-30-2016 at 12:56 PM.
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Delete picture macro wont work

    Is the sheet you insert the picture on Sheet1 ?

    The delete code uses Sheet1 specifically but the insert code uses the Active sheet.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  5. #5
    Registered User
    Join Date
    08-15-2016
    Location
    Cincinnati Ohio
    MS-Off Ver
    Professional Plus 2010
    Posts
    2

    Re: Delete picture macro wont work

    that is all it was. I was leaving out the word 'linked'

    thanks for the quick response.

    solved

+ 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. Macro wont work in 2007 but ok in 20010
    By donkey_uk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-17-2014, 08:15 AM
  2. [SOLVED] Macro wont work when sheet is protected
    By Willardio in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-21-2012, 07:44 PM
  3. VBA Search Macro works in 2007 wont work when using 2003
    By kmkelley in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-13-2011, 05:11 PM
  4. Why wont my macro work
    By Leper in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-01-2007, 11:24 AM
  5. Extremely simple macro wont work
    By tanewha69 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-31-2006, 05:53 PM
  6. [SOLVED] delete picture with macro
    By Steve in forum Excel General
    Replies: 1
    Last Post: 03-16-2006, 06:20 PM
  7. macro wont work
    By Dan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-02-2005, 01:06 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