Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 03-16-2022, 08:44 AM
ievakr ievakr is offline Hyperlink.Delete does not work properly Windows 10 Hyperlink.Delete does not work properly Office 2019
Novice
Hyperlink.Delete does not work properly
 
Join Date: Mar 2022
Posts: 1
ievakr is on a distinguished road
Question Hyperlink.Delete does not work properly

Hello,


What I want to do, is for macro to find all hyperlinks with word "servlet" in the address and delete the hyperlink:

Code:
Sub Link()


Dim H As Hyperlink
    For Each H In ActiveDocument.Hyperlinks
        If InStr(H.Address, "servlet") <> 0 Then
            H.Delete
        End If
    Next H
End Sub
But H.Delete breaks the Next H function and in result only every second hyperlink is deleted and I have to run the macro again. Meanwhile H.Follow works like a charm in this code.
What can it be?
  #2  
Old 03-16-2022, 10:25 AM
Charles Kenyon Charles Kenyon is offline Hyperlink.Delete does not work properly Windows 10 Hyperlink.Delete does not work properly Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,470
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Cross-posted and answered at VBA Hyperlink.Delete does not work properly.

For cross-posting etiquette, please read: A Message to Forum Cross-Posters Excelguru Help Site - A message to forum cross posters
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lookup function does not work properly Intruder Excel 3 06-01-2020 09:24 AM
Hyperlink.Delete does not work properly Function SaveAs2 does not work properly Marco Hof Word VBA 2 06-13-2016 07:39 AM
Hyperlink: open the document only once, quit & reopen PP, hyperlink doesnt work anymore quanghuynguyenhua PowerPoint 0 10-10-2015 06:17 PM
formula does not work properly msnarayanan Excel 2 08-12-2015 12:40 AM
Hyperlink not appearing properly in word 2010 sathish Word 2 04-27-2014 10:09 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:25 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft