Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Removing Objects
Hello,
I have a workbook that contains 5 worksheets. In each worksheet, I have a few picture objects. Is there a way that we can write a code to remove all the picture objects in the worksheets of the workbook? Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Removing Objects
Hi Please Help
Look here http://www.rondebruin.nl/controlsobjectsworksheet.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Please Help" <Please wrote in message ... Hello, I have a workbook that contains 5 worksheets. In each worksheet, I have a few picture objects. Is there a way that we can write a code to remove all the picture objects in the worksheets of the workbook? Thanks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Removing Objects
Ron,
Looking at that link I see that you quote some code from Dave P and myself regarding deleting shapes (Shapes4). Your example is for Forms controls only, whereas we have posted code for both Forms and Control Toolbox. I didn't read the item in depth, it may be you were only looking for Forms shapes, but just in case, I enclose the full code (PS it does still preserve data validation and autofilter dropdown arrows <G) Sub DeleteShapes() Dim shp As Shape Dim testStr As String Dim OkToDelete As Boolean For Each shp In ActiveSheet.Shapes OkToDelete = True testStr = "" On Error Resume Next testStr = shp.TopLeftCell.Address On Error GoTo 0 If shp.Type = msoFormControl Then If shp.FormControlType = xlDropDown Then If testStr = "" Then 'keep it OkToDelete = False End If End If End If If OkToDelete Then shp.Delete End If Next shp End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Ron de Bruin" wrote in message ... Hi Please Help Look here http://www.rondebruin.nl/controlsobjectsworksheet.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Please Help" <Please wrote in message ... Hello, I have a workbook that contains 5 worksheets. In each worksheet, I have a few picture objects. Is there a way that we can write a code to remove all the picture objects in the worksheets of the workbook? Thanks. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Removing Objects
Hi Bob The example is only for Forms controls Bob on the page because there is the problem I maybe add it after I update the page with 2007 stuff I have send you a private mail Bob -- Regards Ron de Bruin http://www.rondebruin.nl "Bob Phillips" wrote in message ... Ron, Looking at that link I see that you quote some code from Dave P and myself regarding deleting shapes (Shapes4). Your example is for Forms controls only, whereas we have posted code for both Forms and Control Toolbox. I didn't read the item in depth, it may be you were only looking for Forms shapes, but just in case, I enclose the full code (PS it does still preserve data validation and autofilter dropdown arrows <G) Sub DeleteShapes() Dim shp As Shape Dim testStr As String Dim OkToDelete As Boolean For Each shp In ActiveSheet.Shapes OkToDelete = True testStr = "" On Error Resume Next testStr = shp.TopLeftCell.Address On Error GoTo 0 If shp.Type = msoFormControl Then If shp.FormControlType = xlDropDown Then If testStr = "" Then 'keep it OkToDelete = False End If End If End If If OkToDelete Then shp.Delete End If Next shp End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Ron de Bruin" wrote in message ... Hi Please Help Look here http://www.rondebruin.nl/controlsobjectsworksheet.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Please Help" <Please wrote in message ... Hello, I have a workbook that contains 5 worksheets. In each worksheet, I have a few picture objects. Is there a way that we can write a code to remove all the picture objects in the worksheets of the workbook? Thanks. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Removing Objects
Yeah, thanks I have it. Will reply tonight.
-- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Ron de Bruin" wrote in message ... Hi Bob The example is only for Forms controls Bob on the page because there is the problem I maybe add it after I update the page with 2007 stuff I have send you a private mail Bob -- Regards Ron de Bruin http://www.rondebruin.nl "Bob Phillips" wrote in message ... Ron, Looking at that link I see that you quote some code from Dave P and myself regarding deleting shapes (Shapes4). Your example is for Forms controls only, whereas we have posted code for both Forms and Control Toolbox. I didn't read the item in depth, it may be you were only looking for Forms shapes, but just in case, I enclose the full code (PS it does still preserve data validation and autofilter dropdown arrows <G) Sub DeleteShapes() Dim shp As Shape Dim testStr As String Dim OkToDelete As Boolean For Each shp In ActiveSheet.Shapes OkToDelete = True testStr = "" On Error Resume Next testStr = shp.TopLeftCell.Address On Error GoTo 0 If shp.Type = msoFormControl Then If shp.FormControlType = xlDropDown Then If testStr = "" Then 'keep it OkToDelete = False End If End If End If If OkToDelete Then shp.Delete End If Next shp End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Ron de Bruin" wrote in message ... Hi Please Help Look here http://www.rondebruin.nl/controlsobjectsworksheet.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Please Help" <Please wrote in message ... Hello, I have a workbook that contains 5 worksheets. In each worksheet, I have a few picture objects. Is there a way that we can write a code to remove all the picture objects in the worksheets of the workbook? Thanks. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Removing Objects
Thanks both. The code works.
"Ron de Bruin" wrote: Hi Bob The example is only for Forms controls Bob on the page because there is the problem I maybe add it after I update the page with 2007 stuff I have send you a private mail Bob -- Regards Ron de Bruin http://www.rondebruin.nl "Bob Phillips" wrote in message ... Ron, Looking at that link I see that you quote some code from Dave P and myself regarding deleting shapes (Shapes4). Your example is for Forms controls only, whereas we have posted code for both Forms and Control Toolbox. I didn't read the item in depth, it may be you were only looking for Forms shapes, but just in case, I enclose the full code (PS it does still preserve data validation and autofilter dropdown arrows <G) Sub DeleteShapes() Dim shp As Shape Dim testStr As String Dim OkToDelete As Boolean For Each shp In ActiveSheet.Shapes OkToDelete = True testStr = "" On Error Resume Next testStr = shp.TopLeftCell.Address On Error GoTo 0 If shp.Type = msoFormControl Then If shp.FormControlType = xlDropDown Then If testStr = "" Then 'keep it OkToDelete = False End If End If End If If OkToDelete Then shp.Delete End If Next shp End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Ron de Bruin" wrote in message ... Hi Please Help Look here http://www.rondebruin.nl/controlsobjectsworksheet.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Please Help" <Please wrote in message ... Hello, I have a workbook that contains 5 worksheets. In each worksheet, I have a few picture objects. Is there a way that we can write a code to remove all the picture objects in the worksheets of the workbook? Thanks. |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Removing Objects
Ron,
Your code and Bob's code work well, except I have a little problem. How can we modify it to exclude from deleting text boxes? I only want to delete picture objects, neither forms or control objects. Thanks. "Ron de Bruin" wrote: Hi Please Help Look here http://www.rondebruin.nl/controlsobjectsworksheet.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Please Help" <Please wrote in message ... Hello, I have a workbook that contains 5 worksheets. In each worksheet, I have a few picture objects. Is there a way that we can write a code to remove all the picture objects in the worksheets of the workbook? Thanks. |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Removing Objects
Try this
Sub Shapes2() 'Loop through the Shapes collection and use the Type number of the control Dim myshape As Shape For Each myshape In ActiveSheet.Shapes ' Pictures If myshape.Type = 13 Then myshape.Delete Next myshape End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Please Help" wrote in message ... Ron, Your code and Bob's code work well, except I have a little problem. How can we modify it to exclude from deleting text boxes? I only want to delete picture objects, neither forms or control objects. Thanks. "Ron de Bruin" wrote: Hi Please Help Look here http://www.rondebruin.nl/controlsobjectsworksheet.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Please Help" <Please wrote in message ... Hello, I have a workbook that contains 5 worksheets. In each worksheet, I have a few picture objects. Is there a way that we can write a code to remove all the picture objects in the worksheets of the workbook? Thanks. |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Removing Objects
Ron,
You are the best. Thank you very much. It works. By the way, where can I go to find out what shape type is what #. Thanks. "Ron de Bruin" wrote: Try this Sub Shapes2() 'Loop through the Shapes collection and use the Type number of the control Dim myshape As Shape For Each myshape In ActiveSheet.Shapes ' Pictures If myshape.Type = 13 Then myshape.Delete Next myshape End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Please Help" wrote in message ... Ron, Your code and Bob's code work well, except I have a little problem. How can we modify it to exclude from deleting text boxes? I only want to delete picture objects, neither forms or control objects. Thanks. "Ron de Bruin" wrote: Hi Please Help Look here http://www.rondebruin.nl/controlsobjectsworksheet.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Please Help" <Please wrote in message ... Hello, I have a workbook that contains 5 worksheets. In each worksheet, I have a few picture objects. Is there a way that we can write a code to remove all the picture objects in the worksheets of the workbook? Thanks. |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Removing Objects
Look for msoShapeType in the object browser, all listed there.
-- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Ron de Bruin" wrote in message ... Try this Sub Shapes2() 'Loop through the Shapes collection and use the Type number of the control Dim myshape As Shape For Each myshape In ActiveSheet.Shapes ' Pictures If myshape.Type = 13 Then myshape.Delete Next myshape End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Please Help" wrote in message ... Ron, Your code and Bob's code work well, except I have a little problem. How can we modify it to exclude from deleting text boxes? I only want to delete picture objects, neither forms or control objects. Thanks. "Ron de Bruin" wrote: Hi Please Help Look here http://www.rondebruin.nl/controlsobjectsworksheet.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Please Help" <Please wrote in message ... Hello, I have a workbook that contains 5 worksheets. In each worksheet, I have a few picture objects. Is there a way that we can write a code to remove all the picture objects in the worksheets of the workbook? Thanks. |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Removing Objects
List is on my site
-- Regards Ron de Bruin http://www.rondebruin.nl "Please Help" wrote in message ... Ron, You are the best. Thank you very much. It works. By the way, where can I go to find out what shape type is what #. Thanks. "Ron de Bruin" wrote: Try this Sub Shapes2() 'Loop through the Shapes collection and use the Type number of the control Dim myshape As Shape For Each myshape In ActiveSheet.Shapes ' Pictures If myshape.Type = 13 Then myshape.Delete Next myshape End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Please Help" wrote in message ... Ron, Your code and Bob's code work well, except I have a little problem. How can we modify it to exclude from deleting text boxes? I only want to delete picture objects, neither forms or control objects. Thanks. "Ron de Bruin" wrote: Hi Please Help Look here http://www.rondebruin.nl/controlsobjectsworksheet.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Please Help" <Please wrote in message ... Hello, I have a workbook that contains 5 worksheets. In each worksheet, I have a few picture objects. Is there a way that we can write a code to remove all the picture objects in the worksheets of the workbook? Thanks. |
#12
Posted to microsoft.public.excel.programming
|
|||
|
|||
Removing Objects
I got it. What is the different between 11 (msoLinkedPicture) and 13
(msoPicture)? Thanks both. "Bob Phillips" wrote: Look for msoShapeType in the object browser, all listed there. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Ron de Bruin" wrote in message ... Try this Sub Shapes2() 'Loop through the Shapes collection and use the Type number of the control Dim myshape As Shape For Each myshape In ActiveSheet.Shapes ' Pictures If myshape.Type = 13 Then myshape.Delete Next myshape End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Please Help" wrote in message ... Ron, Your code and Bob's code work well, except I have a little problem. How can we modify it to exclude from deleting text boxes? I only want to delete picture objects, neither forms or control objects. Thanks. "Ron de Bruin" wrote: Hi Please Help Look here http://www.rondebruin.nl/controlsobjectsworksheet.htm -- Regards Ron de Bruin http://www.rondebruin.nl "Please Help" <Please wrote in message ... Hello, I have a workbook that contains 5 worksheets. In each worksheet, I have a few picture objects. Is there a way that we can write a code to remove all the picture objects in the worksheets of the workbook? Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
removing objects..! | Excel Discussion (Misc queries) | |||
Removing patterns without removing gridlines | Excel Discussion (Misc queries) | |||
Dynamically Assign Objects to Form Objects. | Excel Programming | |||
Unable to remove Sheet objects in the Microsoft Excel Objects | Excel Programming | |||
Removing objects without unmerging cells | Excel Programming |