<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: VBA: Delete Hyperlinks</title>
	<atom:link href="http://www.automateexcel.com/2005/01/14/excel_vba_delete_hyperlinks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.automateexcel.com/2005/01/14/excel_vba_delete_hyperlinks/</link>
	<description>Hundreds of Excel Tips &#38; Tricks</description>
	<lastBuildDate>Wed, 10 Mar 2010 07:03:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Mark</title>
		<link>http://www.automateexcel.com/2005/01/14/excel_vba_delete_hyperlinks/comment-page-1/#comment-70</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Thu, 22 Sep 2005 09:51:54 +0000</pubDate>
		<guid isPermaLink="false">#comment-70</guid>
		<description>so.... shape.hyperlink.delete syntax does work, however it fails if a hyperlink doesn&#039;t exist on an object. &lt;br /&gt;
&lt;br /&gt;
I can&#039;t find anything off the top of my head to test whether there is a hyperlink on a shape or not (all logic fails with errors, bug?), so I present a very ugly solution:&lt;br /&gt;
&lt;br /&gt;
Isolate the delete code by itself, try to delete for a shape, ignore any error.  Not pretty, but works for me, Excel 2003&lt;br /&gt;
&lt;br /&gt;
This code loops through all shapes on sheet1 and deletes the hyperlinks...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sub DeleteAllShapeHyperlinks()&lt;br /&gt;
    Sheet1.Activate&lt;br /&gt;
&lt;br /&gt;
    Dim GetShape As Shape&lt;br /&gt;
&lt;br /&gt;
    For Each GetShape In ActiveSheet.Shapes&lt;br /&gt;
        KillHyperlink (GetShape.Name)&lt;br /&gt;
    Next&lt;br /&gt;
&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
Function KillHyperlink(WhatShape As String)&lt;br /&gt;
    On Error Resume Next&lt;br /&gt;
    ActiveSheet.Shapes(WhatShape).Hyperlink.Delete&lt;br /&gt;
End Function&lt;br /&gt;
&lt;br /&gt;
Sorry I can&#039;t be more help,&lt;br /&gt;
&lt;br /&gt;
Mark</description>
		<content:encoded><![CDATA[<p>so&#8230;. shape.hyperlink.delete syntax does work, however it fails if a hyperlink doesn&#8217;t exist on an object. </p>
<p>I can&#8217;t find anything off the top of my head to test whether there is a hyperlink on a shape or not (all logic fails with errors, bug?), so I present a very ugly solution:</p>
<p>Isolate the delete code by itself, try to delete for a shape, ignore any error.  Not pretty, but works for me, Excel 2003</p>
<p>This code loops through all shapes on sheet1 and deletes the hyperlinks&#8230;</p>
<p>
Sub DeleteAllShapeHyperlinks()<br />
    Sheet1.Activate</p>
<p>    Dim GetShape As Shape</p>
<p>    For Each GetShape In ActiveSheet.Shapes<br />
        KillHyperlink (GetShape.Name)<br />
    Next</p>
<p>End Sub</p>
<p>Function KillHyperlink(WhatShape As String)<br />
    On Error Resume Next<br />
    ActiveSheet.Shapes(WhatShape).Hyperlink.Delete<br />
End Function</p>
<p>Sorry I can&#8217;t be more help,</p>
<p>Mark</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vivek</title>
		<link>http://www.automateexcel.com/2005/01/14/excel_vba_delete_hyperlinks/comment-page-1/#comment-71</link>
		<dc:creator>vivek</dc:creator>
		<pubDate>Wed, 21 Sep 2005 23:00:19 +0000</pubDate>
		<guid isPermaLink="false">#comment-71</guid>
		<description>I am trying somthing like this, its not removing hyperlink from org. chart&lt;br /&gt;
&lt;br /&gt;
Dim objexcel As Excel.Application&lt;br /&gt;
Dim objworksheet As Excel.Worksheet&lt;br /&gt;
Dim objworkbook As Excel.Workbooks&lt;br /&gt;
&lt;br /&gt;
Private Sub cmddelete_Click()&lt;br /&gt;
  Set objexcel = CreateObject(&quot;Excel.Application&quot;)&lt;br /&gt;
  objexcel.Workbooks.Open (&quot;c:test hyper.xls&quot;)&lt;br /&gt;
  objexcel.WindowState = xlMinimized&lt;br /&gt;
  objexcel.WindowState = xlMaximized&lt;br /&gt;
      &lt;br /&gt;
  Dim Shp As Excel.ShapeRange&lt;br /&gt;
  Dim IShp As Excel.Shape&lt;br /&gt;
  Dim i As Integer&lt;br /&gt;
  Dim j As Integer&lt;br /&gt;
  On Error GoTo ResNextShp&lt;br /&gt;
  For j = 1 To objexcel.ActiveSheet.Shapes.Count&lt;br /&gt;
    objexcel.ActiveSheet.Shapes(j).Select&lt;br /&gt;
    Set Shp = Selection.ShapeRange&lt;br /&gt;
    If Shp.HasDiagramNode = msoTrue Then&lt;br /&gt;
      For i = 1 To Shp.DiagramNode.Diagram.Nodes.Count&lt;br /&gt;
        Set IShp = Shp.DiagramNode.Diagram.Nodes(i).Shape&lt;br /&gt;
        If IShp.Hyperlink.Address  &quot;&quot; Then&lt;br /&gt;
        IShp.Hyperlink.Delete&lt;br /&gt;
        End If&lt;br /&gt;
      Next i&lt;br /&gt;
    End If&lt;br /&gt;
    Set IShp = objexcel.ActiveSheet.Shapes(j)&lt;br /&gt;
    If IShp.Hyperlink.Address  &quot;&quot; Then&lt;br /&gt;
    IShp.Hyperlink.Delete&lt;br /&gt;
    End If&lt;br /&gt;
  Next j&lt;br /&gt;
  i = 0&lt;br /&gt;
  For i = objexcel.ActiveSheet.Hyperlinks.Count To 1 Step -1&lt;br /&gt;
    objexcel.ActiveSheet.Hyperlinks(i).Delete&lt;br /&gt;
  Next i&lt;br /&gt;
  Exit Sub&lt;br /&gt;
&lt;br /&gt;
ResNextShp:&lt;br /&gt;
  Resume Next&lt;br /&gt;
&lt;br /&gt;
End Sub&lt;br /&gt;
</description>
		<content:encoded><![CDATA[<p>I am trying somthing like this, its not removing hyperlink from org. chart</p>
<p>Dim objexcel As Excel.Application<br />
Dim objworksheet As Excel.Worksheet<br />
Dim objworkbook As Excel.Workbooks</p>
<p>Private Sub cmddelete_Click()<br />
  Set objexcel = CreateObject(&#8220;Excel.Application&#8221;)<br />
  objexcel.Workbooks.Open (&#8220;c:test hyper.xls&#8221;)<br />
  objexcel.WindowState = xlMinimized<br />
  objexcel.WindowState = xlMaximized</p>
<p>  Dim Shp As Excel.ShapeRange<br />
  Dim IShp As Excel.Shape<br />
  Dim i As Integer<br />
  Dim j As Integer<br />
  On Error GoTo ResNextShp<br />
  For j = 1 To objexcel.ActiveSheet.Shapes.Count<br />
    objexcel.ActiveSheet.Shapes(j).Select<br />
    Set Shp = Selection.ShapeRange<br />
    If Shp.HasDiagramNode = msoTrue Then<br />
      For i = 1 To Shp.DiagramNode.Diagram.Nodes.Count<br />
        Set IShp = Shp.DiagramNode.Diagram.Nodes(i).Shape<br />
        If IShp.Hyperlink.Address  &#8220;&#8221; Then<br />
        IShp.Hyperlink.Delete<br />
        End If<br />
      Next i<br />
    End If<br />
    Set IShp = objexcel.ActiveSheet.Shapes(j)<br />
    If IShp.Hyperlink.Address  &#8220;&#8221; Then<br />
    IShp.Hyperlink.Delete<br />
    End If<br />
  Next j<br />
  i = 0<br />
  For i = objexcel.ActiveSheet.Hyperlinks.Count To 1 Step -1<br />
    objexcel.ActiveSheet.Hyperlinks(i).Delete<br />
  Next i<br />
  Exit Sub</p>
<p>ResNextShp:<br />
  Resume Next</p>
<p>End Sub</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://www.automateexcel.com/2005/01/14/excel_vba_delete_hyperlinks/comment-page-1/#comment-73</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Wed, 21 Sep 2005 04:16:37 +0000</pubDate>
		<guid isPermaLink="false">#comment-73</guid>
		<description>Change &quot;Autoshape 1&quot; with the codename of your autoshape.&lt;br /&gt;
&lt;br /&gt;
Yet another way would be to use the looping code from this link: &lt;a href=&quot;http://www.automateexcel.com/index.php/2004/11/29/excel_vba_delete_all_autoshapes&quot; rel=&quot;nofollow&quot;&gt;VBA Delete All Autoshapes&lt;/a&gt;, and the hyperlink.delete from my previous comment to remove all hyperlinks from all autoshapes.</description>
		<content:encoded><![CDATA[<p>Change &#8220;Autoshape 1&#8243; with the codename of your autoshape.</p>
<p>Yet another way would be to use the looping code from this link: <a href="http://www.automateexcel.com/index.php/2004/11/29/excel_vba_delete_all_autoshapes" rel="nofollow">VBA Delete All Autoshapes</a>, and the hyperlink.delete from my previous comment to remove all hyperlinks from all autoshapes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vivek</title>
		<link>http://www.automateexcel.com/2005/01/14/excel_vba_delete_hyperlinks/comment-page-1/#comment-72</link>
		<dc:creator>vivek</dc:creator>
		<pubDate>Wed, 21 Sep 2005 03:02:02 +0000</pubDate>
		<guid isPermaLink="false">#comment-72</guid>
		<description>Sorry, but this code is not working...&lt;br /&gt;
</description>
		<content:encoded><![CDATA[<p>Sorry, but this code is not working&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://www.automateexcel.com/2005/01/14/excel_vba_delete_hyperlinks/comment-page-1/#comment-75</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Tue, 20 Sep 2005 17:46:59 +0000</pubDate>
		<guid isPermaLink="false">#comment-75</guid>
		<description>Here&#039;s one way:&lt;br /&gt;
&lt;br /&gt;
    ActiveSheet.Shapes(&quot;AutoShape 1&quot;).Select&lt;br /&gt;
    Selection.ShapeRange.Item(1).Hyperlink.Delete</description>
		<content:encoded><![CDATA[<p>Here&#8217;s one way:</p>
<p>    ActiveSheet.Shapes(&#8220;AutoShape 1&#8243;).Select<br />
    Selection.ShapeRange.Item(1).Hyperlink.Delete</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vivek</title>
		<link>http://www.automateexcel.com/2005/01/14/excel_vba_delete_hyperlinks/comment-page-1/#comment-74</link>
		<dc:creator>vivek</dc:creator>
		<pubDate>Tue, 20 Sep 2005 06:54:30 +0000</pubDate>
		<guid isPermaLink="false">#comment-74</guid>
		<description>If graphical object has hyperlink then it dosn&#039;t delete.&lt;br /&gt;
what is the way to do it?&lt;br /&gt;
eg:- we have a organization chart and we placed a hyperlink in it.&lt;br /&gt;
How can we delete it?&lt;br /&gt;
</description>
		<content:encoded><![CDATA[<p>If graphical object has hyperlink then it dosn&#8217;t delete.<br />
what is the way to do it?<br />
eg:- we have a organization chart and we placed a hyperlink in it.<br />
How can we delete it?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
