PC Review


Reply
Thread Tools Rate Thread

delete group not object

 
 
karmela
Guest
Posts: n/a
 
      30th Nov 2007
Hi,
I have sheet, where there is a picture named Object 1 (an in formula bar is
formula =INSERT("Word.Picture.8";"") ) - this I need to leave on the Sheet.
Then there is Group11, which I need to delete

I have this part of macro but it deletes both objects.


Sheets(hlavni).Select
ActiveSheet.DrawingObjects.Delete

I tried also this code, but it didn't find anything.

For Each shp In ActiveSheet.Shapes
If shp.Type = msoGroup Then
shp.Delete
End If
Next shp

Could anyone find a mistake?

Thanks karmela
 
Reply With Quote
 
 
 
 
Nigel
Guest
Posts: n/a
 
      30th Nov 2007
Your second code >

For Each shp In ActiveSheet.Shapes
If shp.Type = msoGroup Then
shp.Delete
End If
Next shp

As the code refers to the ActiveSheet, make sure you have the one with the
objects selected when you run the code. Alternatively add an explicit
reference to the sheet. Also check are the sheets/objects protected?

For Each shp in Sheets("mySheet").Shapes

etc....

--

Regards,
Nigel
(E-Mail Removed)



"karmela" <(E-Mail Removed)> wrote in message
news:3D81F157-0DED-48F3-8052-(E-Mail Removed)...
> Hi,
> I have sheet, where there is a picture named Object 1 (an in formula bar
> is
> formula =INSERT("Word.Picture.8";"") ) - this I need to leave on the
> Sheet.
> Then there is Group11, which I need to delete
>
> I have this part of macro but it deletes both objects.
>
>
> Sheets(hlavni).Select
> ActiveSheet.DrawingObjects.Delete
>
> I tried also this code, but it didn't find anything.
>
> For Each shp In ActiveSheet.Shapes
> If shp.Type = msoGroup Then
> shp.Delete
> End If
> Next shp
>
> Could anyone find a mistake?
>
> Thanks karmela


 
Reply With Quote
 
karmela
Guest
Posts: n/a
 
      30th Nov 2007
Hi,

in the code before I have reference to the right sheet with the explicit
name, I hade there the first code that goes ok, but deletes more then I want
to...

karmela

"Nigel" wrote:

> Your second code >
>
> For Each shp In ActiveSheet.Shapes
> If shp.Type = msoGroup Then
> shp.Delete
> End If
> Next shp
>
> As the code refers to the ActiveSheet, make sure you have the one with the
> objects selected when you run the code. Alternatively add an explicit
> reference to the sheet. Also check are the sheets/objects protected?
>
> For Each shp in Sheets("mySheet").Shapes
>
> etc....
>
> --
>
> Regards,
> Nigel
> (E-Mail Removed)
>
>
>
> "karmela" <(E-Mail Removed)> wrote in message
> news:3D81F157-0DED-48F3-8052-(E-Mail Removed)...
> > Hi,
> > I have sheet, where there is a picture named Object 1 (an in formula bar
> > is
> > formula =INSERT("Word.Picture.8";"") ) - this I need to leave on the
> > Sheet.
> > Then there is Group11, which I need to delete
> >
> > I have this part of macro but it deletes both objects.
> >
> >
> > Sheets(hlavni).Select
> > ActiveSheet.DrawingObjects.Delete
> >
> > I tried also this code, but it didn't find anything.
> >
> > For Each shp In ActiveSheet.Shapes
> > If shp.Type = msoGroup Then
> > shp.Delete
> > End If
> > Next shp
> >
> > Could anyone find a mistake?
> >
> > Thanks karmela

>

 
Reply With Quote
 
Nigel
Guest
Posts: n/a
 
      30th Nov 2007
Your first code works because it deletes all drawing objects. The 2nd code
should only delete the drawing objects that have been grouped, it does work
if you select the sheet before running the code, alternatively add an
explicit reference as I suggested.

Make sure objects and sheets are not protected

--

Regards,
Nigel
(E-Mail Removed)



"karmela" <(E-Mail Removed)> wrote in message
news:B5E0D81C-5607-4D13-A623-(E-Mail Removed)...
> Hi,
>
> in the code before I have reference to the right sheet with the explicit
> name, I hade there the first code that goes ok, but deletes more then I
> want
> to...
>
> karmela
>
> "Nigel" wrote:
>
>> Your second code >
>>
>> For Each shp In ActiveSheet.Shapes
>> If shp.Type = msoGroup Then
>> shp.Delete
>> End If
>> Next shp
>>
>> As the code refers to the ActiveSheet, make sure you have the one with
>> the
>> objects selected when you run the code. Alternatively add an explicit
>> reference to the sheet. Also check are the sheets/objects protected?
>>
>> For Each shp in Sheets("mySheet").Shapes
>>
>> etc....
>>
>> --
>>
>> Regards,
>> Nigel
>> (E-Mail Removed)
>>
>>
>>
>> "karmela" <(E-Mail Removed)> wrote in message
>> news:3D81F157-0DED-48F3-8052-(E-Mail Removed)...
>> > Hi,
>> > I have sheet, where there is a picture named Object 1 (an in formula
>> > bar
>> > is
>> > formula =INSERT("Word.Picture.8";"") ) - this I need to leave on the
>> > Sheet.
>> > Then there is Group11, which I need to delete
>> >
>> > I have this part of macro but it deletes both objects.
>> >
>> >
>> > Sheets(hlavni).Select
>> > ActiveSheet.DrawingObjects.Delete
>> >
>> > I tried also this code, but it didn't find anything.
>> >
>> > For Each shp In ActiveSheet.Shapes
>> > If shp.Type = msoGroup Then
>> > shp.Delete
>> > End If
>> > Next shp
>> >
>> > Could anyone find a mistake?
>> >
>> > Thanks karmela

>>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Unable to delete Navigation group using NavigationGroups.Delete ed.sheldon@ittralee.ie Microsoft Outlook VBA Programming 0 13th Nov 2009 10:22 PM
Can't delete a Group Policy Object. Mario Lavigne Microsoft Windows 2000 Group Policy 7 6th Oct 2005 06:41 PM
group policy object Bigpotato Microsoft Windows 2000 Active Directory 8 12th Feb 2005 02:23 AM
Object Group =?Utf-8?B?RUI=?= Microsoft Access VBA Modules 0 16th Nov 2004 05:18 PM
what object group does this reside in Ricky M. Medley Microsoft Excel Programming 1 9th Dec 2003 11:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:37 PM.