Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Creating an organization diagram in Excel

Hi,

I am trying to create an organization chart programmatically in excel.
I got this code from a previous posting, but adding text doesn't work.
I also need to link the boxes together. Can someone please post some
code on how to do that?

Thanks

Dim shDiagram as Shape
Dim nodRoot As DiagramNode
Set shDiagram = ActiveSheet.Shapes.AddDiagram( _
Type:=msoDiagramOrgChart, Top:=10, _
Left:=15, Width:=400, Height:=475)
Set nodRoot = shDiagram.DiagramNode.Children.AddNode
nodRoot.TextShape.TextFrame.Characters.Text = "First Node"

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Creating an organization diagram in Excel

sedky,
Record a macro creating 2 shapes and placing a connctor between them, from
the options on the Drawing toolbar. You'll get code that looks like:

ActiveSheet.Shapes.AddShape(msoShapeFlowchartProce ss, 97.5, 171#, 127.5,
48.75).Select
ActiveSheet.Shapes.AddShape(msoShapeFlowchartPrepa ration, 327.75, 95.25,
197.25, 54#).Select
ActiveSheet.Shapes.AddConnector(msoConnectorStraig ht, 225#, 148.5, 110.25,
47.25).Select
Selection.ShapeRange.ConnectorFormat.BeginConnect
ActiveSheet.Shapes("AutoShape 1"), 4
Selection.ShapeRange.ConnectorFormat.EndConnect
ActiveSheet.Shapes("AutoShape 2"), 2

NickHK

wrote in message
oups.com...
Hi,

I am trying to create an organization chart programmatically in excel.
I got this code from a previous posting, but adding text doesn't work.
I also need to link the boxes together. Can someone please post some
code on how to do that?

Thanks

Dim shDiagram as Shape
Dim nodRoot As DiagramNode
Set shDiagram = ActiveSheet.Shapes.AddDiagram( _
Type:=msoDiagramOrgChart, Top:=10, _
Left:=15, Width:=400, Height:=475)
Set nodRoot = shDiagram.DiagramNode.Children.AddNode
nodRoot.TextShape.TextFrame.Characters.Text = "First Node"



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Creating an organization diagram in Excel

For some reason, I don't have the macro recorder. The macro security is
set to Low !!
By the way the organizational chart is better than the flowchart.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Creating an organization diagram in Excel

sedky,
If you cannot record a macro then how are you going to run any VBA code.
I assume this is a feature added after Excel 9, but I would imagine
something similar would apply.

NickHK

wrote in message
ups.com...
For some reason, I don't have the macro recorder. The macro security is
set to Low !!
By the way the organizational chart is better than the flowchart.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Creating an organization diagram in Excel

"this" refers to the organisational chart, not inability of running macros,
in case anyone was in doubt.

NickHK

"NickHK" wrote in message
...
sedky,
If you cannot record a macro then how are you going to run any VBA code.
I assume this is a feature added after Excel 9, but I would imagine
something similar would apply.

NickHK

wrote in message
ups.com...
For some reason, I don't have the macro recorder. The macro security is
set to Low !!
By the way the organizational chart is better than the flowchart.







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Creating an organization diagram in Excel

I am able to run VBA code. I am running Excel 2003 by the way, but for
some reason "Record Macro" is not on the list. The code that I
originally pasted is fully functional (even the code you suggested),
but I wanted to get an idea of how to link up those organizational
chart boxes.

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
Tree organization in excel Francisco Excel Discussion (Misc queries) 6 September 12th 07 04:56 PM
where can I get organization chart add-in for Excel 2000? kturvey Excel Discussion (Misc queries) 1 July 26th 07 05:58 PM
Excel Data Re-Organization Freedle Beetle Excel Discussion (Misc queries) 1 December 6th 05 07:17 PM
Creating Time location diagram in Excel Sooraj Excel Discussion (Misc queries) 0 January 11th 05 10:18 AM
How do i set up an organization chart in Excel? rox Charts and Charting in Excel 1 December 30th 04 06:11 PM


All times are GMT +1. The time now is 11:25 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"