Thread: Insert Diagram
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Insert Diagram

Sub AddPyramid()
Dim obj As Shape
With Range("B5:J25")
Set obj = ActiveSheet.Shapes.AddDiagram( _
Type:=msoDiagramPyramid, _
Top:=.Top, _
Left:=.Left, _
Width:=.Width, _
Height:=.Height)
Set nd = obj.DiagramNode.Children.AddNode
End With
For i = 1 To 2
nd.AddNode
Next
End Sub


adds the pyramid. I think you will have to play around with the object
model for these to figure out how to get the basic "node" for each type
(beyond changing the type property). Also, I believe these were added in
xl2003, so not available in earlier versions.

--
Regards,
Tom Ogilvy


"Gary''s Student" wrote:

Thank you Tom,

I am just trying to insert one of the pre-canned diagrams via VBA.
--
Gary''s Student


"Tom Ogilvy" wrote:

I doubt there is a way.
Are you just trying to discover the objects associated with that activity?

the shapes collection has an adddiagram method.
--
Regards,
Tom Ogilvy


"Gary''s Student" wrote:

How can I get

Insert Diagram

to function when the Macro Recorder is turned on?
--
Gary's Student