View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
v_gyku[_3_] v_gyku[_3_] is offline
external usenet poster
 
Posts: 1
Default delete hyperlinks from graphical objects in excel sheet

Hi Dave !
I want to tell u somthn.Sorry but I have not mentioned it in the last
post.
Its working fine for rectngles.Not wotking for organization charts.

I give you the code i have written:

Dim objexcel As Excel.Application
Dim objworksheet As Excel.Worksheet
Dim objworkbook As Excel.Workbooks

Private Sub cmddelete_Click()
Set objexcel = CreateObject("Excel.Application")
objexcel.Workbooks.Open ("c:\test hyper.xls")
objexcel.WindowState = xlMinimized
objexcel.WindowState = xlMaximized


Dim Shp As Excel.ShapeRange
Dim IShp As Excel.Shape
Dim i As Integer
Dim j As Integer
On Error GoTo ResNextShp


For j = 1 To objexcel.ActiveSheet.Shapes.Count

objexcel.ActiveSheet.Shapes(j).Select
Set Shp = Selection.ShapeRange
If Shp.HasDiagramNode = msoTrue Then
For i = 1 To Shp.DiagramNode.Diagram.Nodes.Count
Set IShp = Shp.DiagramNode.Diagram.Nodes(i).Shape
If IShp.Hyperlink.Address < "" Then
IShp.Hyperlink.Delete
End If
Next i
End If
Set IShp = objexcel.ActiveSheet.Shapes(j)
If IShp.Hyperlink.Address < "" Then
IShp.Hyperlink.Delete
End If
Next j
i = 0

For i = objexcel.ActiveSheet.Hyperlinks.Count To 1 Step -1
objexcel.ActiveSheet.Hyperlinks(i).Delete
Next i

Exit Sub

ResNextShp:
Resume Next

End Sub