I have a problem finding text within diagram(organization chart) in excel2003.
here is my code
The similar sode works for VBA but not for dotnet.
I have also some fruitful discussion with Mike and Helen at "Xtreme Visual Basic Talk > Visual Basic .NET > .NET Office Automation > Excel and organization chart"
Atif
here is my code
Code:
Dim xlshape As Excel.Shape
Dim xlbook As Excel.Workbook
Dim xlsheet As Excel.Worksheet
Dim xlapp As Excel.Application
xlapp = CType(GetObject(, "excel.Application"), Excel.Application)
xlbook = xlapp.ActiveWorkbook
xlsheet = xlbook.ActiveSheet
xlshape = xlsheet.Shapes.Item(1)
If xlshape.Type = Microsoft.Office.Core.MsoShapeType.msoDiagram Then
It works perfectly
MsgBox(xlsheet.Shapes.Item(1).Diagram.Nodes.Count)
it throughs exception "system.Invalidcast exception"
MsgBox(xlshape.Diagram.Nodes.Item(1).TextShape.TextFrame.Characters.Text)
End If
The similar sode works for VBA but not for dotnet.
I have also some fruitful discussion with Mike and Helen at "Xtreme Visual Basic Talk > Visual Basic .NET > .NET Office Automation > Excel and organization chart"
Atif