+ Reply to Thread
Results 1 to 3 of 3

"PICOBJ.DELETE" to remove shape: Problem when validation list populated

  1. #1
    Registered User
    Join Date
    09-29-2008
    Location
    australia
    Posts
    25

    Angry "PICOBJ.DELETE" to remove shape: Problem when validation list populated

    I have a sheet in which I refresh a picture in a particular cell (F13 in this instance) based on a text string which is converted into a picture via an add-in.

    The sheet also contains a validation pulldown list, and several other images and shapes (as macro buttons).

    Each time I want to refresh the picture with a different one, I delete the 1st picture, copy the new text string (from cell Q20) and paste into cell F13, and then re-iterate the process. This is done via a macro called "template" in Excel 2003.

    Initially, I used the following code for the "delete-copy-paste" sequence:

    Please Login or Register  to view this content.

    This works, but I wanted to improve the code by avoiding "select' statements, and the "processdeletekeystroke" code.

    My initial thought was to use the following (which again works, BUT I later found out that
    it quite happily deleted my validation list too!) in order to remove the picture as a shape:

    Please Login or Register  to view this content.
    With this in mind, I then used the following code, which works nicely (or so I thought):

    Please Login or Register  to view this content.

    The problem with this is that it only works if the validation pull down list is left empty; if I select an item from the list, and then try and delete the picture, i get the following error:

    Run-time error '1004': Application-defined or object-defined error.

    I should note that the following code does NOT work in Excel 2003 (works in 2007, but suffers from the same validation list error):

    Please Login or Register  to view this content.

    So my final complete code (macro "template") for the entire process is as follows:

    Please Login or Register  to view this content.


    I have several questions (or should I say frustrating difficulties) with this code. I list them in order of importance!

    1. Why does the picobj.delete code error when the validation list is populated? How can I delete ONLY the picture of interest?

    2. There is one major flaw that is hampering my overall spreadsheet, and I am convinced it is related to the add-in. Often, the sheet will appear to get stuck in some loop, whereby the page will 'pulse' and the only way to disrupt it is by holding down "ESC". I managed to catch it with the macro recorder, and all I got was hundreds of "Application.run range()" streaming down the page. You would make my day if you could offer some insight into this.

    3. The re-pagination sequence does not always work, in that the column widths and row heights are not always enforced first time around after the new picture is generated.

    If I place the re-pagination sequence using a "Worksheet_Activate" sub in the worksheet module and then re-activate the sheet (either manually or via a macro), the pagination becomes enforced. Any reason why this should be? I can live with this, but it would be nice to have it all happen in the one macro sequence
    Last edited by bubastisbastet; 11-01-2010 at 05:06 PM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: "PICOBJ.DELETE" to remove shape: Problem when validation list populated

    See this for the same problem, specifically Ron de Bruin's answer
    Last edited by royUK; 11-01-2010 at 08:56 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    09-29-2008
    Location
    australia
    Posts
    25

    Re: "PICOBJ.DELETE" to remove shape: Problem when validation list populated

    Thank you. I had seen Ron's page previously, but for some reason the code I used didn't work. I tried it again (below) and it seems to work. I don't have 2003 at home (only 2007), so will have to verify on my sheet 'proper' when I try it at work.

    Please Login or Register  to view this content.

    Can you (or anyone else) comment on my other 2 questions?

    Thanks again.

    bubastisbastet

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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