Ask Experts Questions for FREE Help !
Ask
    rsdjimbie's Avatar
    rsdjimbie Posts: 96, Reputation: 3
    Junior Member
     
    #1

    May 5, 2009, 11:49 PM
    Objects in spreadsheet not selected by recorded macro.
    I have a wage bill with 500 or so employees on it.
    To simplify things, did I add a small photo of each worker next to his details.

    With so many photos on the sheet is it quite large for emailing, and therfore did I record a macro to select and deleat all the photos.
    Once the macro is run, does it do so without any error massages, and I can see the screen updating, but all the photos are still there!
    JBeaucaire's Avatar
    JBeaucaire Posts: 5,426, Reputation: 997
    Software Expert
     
    #2

    May 6, 2009, 09:08 AM

    So, post up a smaller sample of your sheet with your macro in it, I'll take a look at it.
    JBeaucaire's Avatar
    JBeaucaire Posts: 5,426, Reputation: 997
    Software Expert
     
    #3

    May 6, 2009, 10:47 AM

    Or... try this short macro on for size:
    Code:
    Sub DeleteAllPictures()
    Dim DrObj, Pic
    Set DrObj = ActiveSheet.DrawingObjects
    
        For Each Pic In DrObj
            If Left(Pic.Name, 7) = "Picture" Then Pic.Delete
        Next
    End Sub
    rsdjimbie's Avatar
    rsdjimbie Posts: 96, Reputation: 3
    Junior Member
     
    #4

    May 6, 2009, 11:41 AM
    A small example. No macro added as it shows very little. Thank you.
    Attached Files
  1. File Type: xls Photos to delete.xls (352.0 KB, 142 views)
  2. JBeaucaire's Avatar
    JBeaucaire Posts: 5,426, Reputation: 997
    Software Expert
     
    #5

    May 6, 2009, 01:18 PM

    Did you try the macro above, yet?
    JBeaucaire's Avatar
    JBeaucaire Posts: 5,426, Reputation: 997
    Software Expert
     
    #6

    May 6, 2009, 01:21 PM
    You know, always start with the workbook, I say, people always leave out key details like "My workbook is protected".

    Hehe, here, one line of code added to make it runnable on a locked sheet:
    Code:
    Sub DeleteAllPictures()
    Dim DrObj, Pic
    Set DrObj = ActiveSheet.DrawingObjects
    ActiveSheet.Protect UserInterfaceOnly:=True
        For Each Pic In DrObj
            If Left(Pic.Name, 7) = "Picture" Then Pic.Delete
        Next
    End Sub
    rsdjimbie's Avatar
    rsdjimbie Posts: 96, Reputation: 3
    Junior Member
     
    #7

    May 7, 2009, 12:47 AM

    Most imprsesive!
    Thanks JB.
    rsdjimbie's Avatar
    rsdjimbie Posts: 96, Reputation: 3
    Junior Member
     
    #8

    Jan 25, 2011, 05:47 AM
    Now out of the blue is the macro giving me the following error message:"Run time error 1004
    Unable to get the Name property of the picture class."

    Do you have any idea, because I have been looking and cannot find the cause.

    Sheet is not protcted.
    Thanks.
    JBeaucaire's Avatar
    JBeaucaire Posts: 5,426, Reputation: 997
    Software Expert
     
    #9

    Jan 25, 2011, 07:42 AM

    So what's different? Are you still using Excel 2003? Can you post an example of the misbehaving workbook with you current macro in it?
    rsdjimbie's Avatar
    rsdjimbie Posts: 96, Reputation: 3
    Junior Member
     
    #10

    Jan 25, 2011, 10:50 PM
    Moved up to Excel 2007 some time back, but did not have any problem until now. Post to follow, very difficult to get the file to fit the max allowable bites.
    rsdjimbie's Avatar
    rsdjimbie Posts: 96, Reputation: 3
    Junior Member
     
    #11

    Jan 25, 2011, 11:10 PM
    Where is the attachment icon!
    JBeaucaire's Avatar
    JBeaucaire Posts: 5,426, Reputation: 997
    Software Expert
     
    #12

    Jan 26, 2011, 04:10 AM

    You'll have to use the GO ADVANCED icon first.
    rsdjimbie's Avatar
    rsdjimbie Posts: 96, Reputation: 3
    Junior Member
     
    #13

    Jan 26, 2011, 10:56 PM
    Do not have a advance icon either!
    Anyhow, I have used Special-Objects and then "Objects.Delete", works well.
    Code:
    ActiveSheet.DrawingObjects.Select
        ActiveSheet.DrawingObjects.Delete
    Still can not see the advanced icon. Weird.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

FAQ: How to Troubleshoot, Repair & Maintain Hondas and Selected Other Vehicles [ 85 Answers ]

Check out these tips and explanations from our Senior Cars & Trucks Expert. Of course, you're also welcome to post questions to this board for more information: Just click the "Ask about Cars & Trucks" button (NOT the Answer this Question button) at the top of the page. Be sure, though, to...

Total hours from selected records [ 1 Answers ]

I have one table and the fields are start time and end time. I'm already find working hours from stime and etime. But I want total working hours for selected records. i.e I want total hours for 10 selected records.. in msacces

Probability that at least 1 item is selected [ 2 Answers ]

Ok, I do not know if I am doing this right or not. I am coming up with a different number then what one of the answers are. Can anyone help please? Suppose you are going to draw 2 jellyfish, without replacement, from a tank that contains 5 mushroom jellyfish and 3 cannonball jellyfish. Find the...

He3 Kenmore Elite Dryer Won't run selected cycle. [ 4 Answers ]

I have a HE3 Kenmore Dryer Elite. All lights work and you can push selected functions. When you push the start button it sounds like it just clicks off. Won't start the cycle... is this a sensor relay switch problem. The venting and lint is clear. Thanks


View more questions Search