 |
|
|
 |
Junior Member
|
|
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!
|
|
 |
Software Expert
|
|
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.
|
|
 |
Software Expert
|
|
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
|
|
 |
Junior Member
|
|
May 6, 2009, 11:41 AM
|
|
A small example. No macro added as it shows very little. Thank you.
|
|
 |
Software Expert
|
|
May 6, 2009, 01:18 PM
|
|
Did you try the macro above, yet?
|
|
 |
Software Expert
|
|
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
|
|
 |
Junior Member
|
|
May 7, 2009, 12:47 AM
|
|
Most imprsesive!
Thanks JB.
|
|
 |
Junior Member
|
|
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.
|
|
 |
Software Expert
|
|
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?
|
|
 |
Junior Member
|
|
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.
|
|
 |
Junior Member
|
|
Jan 25, 2011, 11:10 PM
|
|
Where is the attachment icon!
|
|
 |
Software Expert
|
|
Jan 26, 2011, 04:10 AM
|
|
You'll have to use the GO ADVANCED icon first.
|
|
 |
Junior Member
|
|
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.
|
|
Question Tools |
Search this Question |
|
|
Add your answer here.
Check out some similar questions!
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
|