PDA

View Full Version : Run-time error method ' ' of object ' ' fail



maryam
05-18-2007, 11:32 PM
method 'ungroup' of object 'ShapeRange' fail

I get this error. This may be an automation error.

there is a sheet on which I put the shapes (Stream and unit shapes). I have an object pallet to bring the shapes and each shape has a textbox which shows its name. In my coding I have the codes like the following to group/ungroup the shape and its textbox when necessaryand Select or delete the shapes.

Sheets("sheet1").Shapes(Stream).Select
Selection.ShapeRange.Ungroup.Select
selection.shaperange.group.select
sheets("sheet1").shapes().delete


NOw when I am trying to run, I get this error and after that if I end error message box and do again, there will be no error but some of the shapes will be deleted!
Previosely my program was running and I didnt change anything, but I dont understand why it doesnt work now.:banghead:

:help :help :help :help :help :help :help :help :help :help :help :help :help :help :help

Paul_Hossler
05-19-2007, 11:37 AM
FWIW, many of my "It used to work!!!" errors will get cleaned up by regular use of Ron Bovey's very good code cleaner

http://www.appspro.com/Utilities/CodeCleaner.htm

"
About the VBA Code Cleaner

During the process of creating VBA programs a lot of junk code builds up in your files. If you don't clean your files periodically you will begin to experience strange problems caused by this extra baggage. Cleaning a project involves exporting the contents of all its VBComponents to text files, deleting the components and then importing the components back from the text files"