View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rodby Rodby is offline
external usenet poster
 
Posts: 8
Default Macro Error that I connot figure out

Thanks,
I put in the steps, and s.parent,name is the worksheet while s.parent.parent
is the workbook. I think I want to "ungroup" (whatever that means) from the
collection of states which is the map of the states.

The idea of the program is to set it up so you can click on the state to
perform an action.

In any event, the statement s.parent.parent.ungroup would seem to separate
the state from the workbook? That does not seem to make any sense.



"Barb Reinhardt" wrote:

I *think* you have one too many "Parent" in there, but it's hard to tell.

Try adding this before your line with the error.

debug.print s.parent.name
debug.print s.parent.parent.name

Does that help you figure anything out?

I suspect that s.parent.parent is the worksheet,
--
HTH,

Barb Reinhardt



"Rodby" wrote:

I am trying to teach myself VBA using Step by Step by Reed Jacobson.
There is a chapter on graphical objects, and in one macro he shows how to
set up an "active map" forma generic state map
Here is the macro:
Sub MakeMapButtons()
Dim s As Shape
myNumber = 3
myName = "oregon"
myCaption = "OR"
myColor = 9
Set s = ActiveSheet.Shapes(1).GroupItems(myNumber)
's.Select
s.Name = myName
s.Fill.ForeColor.ObjectThemeColor = myColor
s.ThreeD.BevelTopDepth = 6
s.TextFrame2.TextRange = myCaption
s.TextFrame2.HorizontalAnchor = msoAnchorCenter
s.TextFrame2.VerticalAnchor = msoAnchorMiddle
s.TextFrame2.TextRange.Font.Size = 20
s.TextFrame2.TextRange.Font.Bold = msoTrue
s.TextFrame2.TextRange.Font.Fill.ForeColor.ObjectT hemeColor =
msoThemeColorLight1
s.Fill.OneColorGradient msoGradientHorizontal, 1, 0
s.TextFrame2.TextRange.Font.Reflection.Type = msoReflectionType5
s.Parent.Parent.Ungroup
s.OnAction = ThisWorkbook.Name & "!StateButton"
s.DrawingObject.ShapeRange.Regroup

Everything works fine until the third line from the bottom:
s.Parent.Parent.Ungroup

I get an error message saying that the object does not support this property.
I copied this program from his answer file and pasted it directly into the
macro shell, so I know that I did not make a typing error, but it still hangs
up.

Any thoughts?