Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Ungrouping shapes

Using Visual Basic 6 (not VBA) and Excel 2000

I have graphics and text grouped together on a worksheet.
I need to update the text.
Trying to ungroup in the follow code I get run time erro 1004 "Application-
defined or object-defined error" from Excel back to VB.

For Each xlWorkSheet In xlWorkbook.Sheets
xlWorkSheet.Select
For I = 1 To xlWorkSheet.Shapes.Count
Shape = xlWorkSheet.Shapes(I)
If Shape.Type = msoGroup Then
Shape.Select
Shape.Ungroup <-- crash and burn here.
End if
Next I
Next xlWorkSheet

help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Ungrouping shapes

Don't use variables that are spelled the same as terms Excel already
has defined... try shp instead of Shape.

Declare your variables with the appropriate data type...
Dim shp as xlApp.Shape

You must "Set" an object (shp) after declaring it so that
Excel knows what it refers to. Or you can use it in a For/Next
loop and Excel will make an implied reference for you...
'--
For Each shp in xlWorkSheet.Shapes
If shp.Type = msoGroup then shp.Ungroup
Next
'--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Carey Carlan"

wrote in message
Using Visual Basic 6 (not VBA) and Excel 2000

I have graphics and text grouped together on a worksheet.
I need to update the text.
Trying to ungroup in the follow code I get run time erro 1004 "Application-
defined or object-defined error" from Excel back to VB.

For Each xlWorkSheet In xlWorkbook.Sheets
xlWorkSheet.Select
For I = 1 To xlWorkSheet.Shapes.Count
Shape = xlWorkSheet.Shapes(I)
If Shape.Type = msoGroup Then
Shape.Select
Shape.Ungroup <-- crash and burn here.
End if
Next I
Next xlWorkSheet

help?
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel document with shapes on it but the shapes do not print [email protected] Excel Worksheet Functions 2 October 22nd 09 06:17 PM
Ungrouping Brad H Excel Discussion (Misc queries) 4 November 13th 08 04:58 PM
Naming Auto Shapes and Creating new Shapes AL2000 Excel Discussion (Misc queries) 3 September 10th 07 04:12 AM
When drawing shapes in excel the shapes keep disappearing Tape Excel Discussion (Misc queries) 1 October 6th 06 04:23 PM
Ungrouping using vb jadasion Excel Programming 0 October 28th 04 09:33 PM


All times are GMT +1. The time now is 08:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"