Organization Chart in Word 2007

H

Hussain

I am trying to generate an Org Chart in Word 2007 from my VB.Net
program. I got the code from http://support.microsoft.com/default.aspx?scid=kb;en-us;317293

The code I have in VB.Net is:

Dim oWord As Object, oDiagram As Object, oTopNode As Object,
oNode As Object
Dim tvNode As TreeNode

oWord = CreateObject("Word.Application")
With oWord
.Visible = True
.Documents.Add()
With .ActiveDocument.Shapes
oDiagram = .AddDiagram(1, 10, 15, 400, 475)
End With
End With
oTopNode = oDiagram.DiagramNode.Children.AddNode()
With oTopNode
.TextShape.TextFrame.TextRange.Text =
tvMyTreeView.SelectedNode.Text
End With

For Each tvNode In tvMyTreeView.SelectedNode.Nodes
With oTopNode
oNode = .Children.AddNode()
End With
With oNode
.TextShape.TextFrame.TextRange.Text = tvNode.Text
End With
Next

This works just fine in Word 2003 but in Word 2007 I get an error
saying: The method or operation is not implemented. This error comes
on the AddDiagram line.

Going through the MSDN pages, there is a page that covers changes in
VBA from Office 2003 to Office 2007. This page says that the
AddDiagram method - along with others - has been changed to "Hidden".
There is no further explanation.

If I write the code in VBA from within Word 2007, the IDE shows that
the AddDiagram method does exists, but also gives an error when I try
to execute the method.

Help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top