Remove hyperlink from pictures

Deepk

Board Regular
Joined
Mar 21, 2018
Messages
105
Office Version
  1. 2016
Platform
  1. Windows
Hi All,

I want a macro that remove hyperlink from all the pictures in an excel worksheet. Please help me. Thank you.

Regards,
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Select the picture and press "Ctrl + A". This will select all shapes. Keep the selection and go to VB Screen and then go to immediate window (Ctrl +G). Paste the below code and press enter

Code:
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">Selection.Hyperlinks.Delete</code>
 
Last edited:
Upvote 0
Select the picture and press "Ctrl + A". This will select all shapes. Keep the selection and go to VB Screen and then go to immediate window (Ctrl +G). Paste the below code and press enter

Code:
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">Selection.Hyperlinks.Delete</code>

Thank you for your reply. based on you input I am running the following code

Sub hyper ()
ActiveSheet.Pictures.Select
Selection.Hyperlinks.Delete
End Sub

But at Selection.Hyperlinks.Delete it is showing an Run time error 438, "Object does not support this property or method"

Please suggest. Thank you.
 
Upvote 0
It appears you treat the pictures as shapes. The following code will remove all hyperlinks from SHAPES, including pictures, on the current Worksheet

Code:
Sub hyper()
    Dim shp As Shape
    For Each shp In ActiveSheet.Shapes
        If shp.Hyperlink.Address <> "" Then shp.Hyperlink.Delete
    Next shp
End Sub
 
Upvote 0
It appears you treat the pictures as shapes. The following code will remove all hyperlinks from SHAPES, including pictures, on the current Worksheet

Code:
Sub hyper()
    Dim shp As Shape
    For Each shp In ActiveSheet.Shapes
        If shp.Hyperlink.Address <> "" Then shp.Hyperlink.Delete
    Next shp
End Sub


Thank you Stiuart_W. Have a good day.
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top