Unfollow a Hyperlink color
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)
Unfollow a Hyperlink color
In Word 2007, there are times when I test a hyperlink by clicking it. Word obligingly turns its color Violet, for a Followed Hyperlink. How can I tell Word (that hyperlink) that you are no longer followed, and please turn back to Blue?
If I change the Followed Hyperlink style color to Blue, that hyperlink turns back to Blue. But I really want a Followed Hyperlink to be Violet. So I change the Followed Hyperlink color back to Violet, and Word somehow remembers that that particular hyperlink was followed, and turns it back to Violet.
How do I Unfollow a hyperlink?
If I change the Followed Hyperlink style color to Blue, that hyperlink turns back to Blue. But I really want a Followed Hyperlink to be Violet. So I change the Followed Hyperlink color back to Violet, and Word somehow remembers that that particular hyperlink was followed, and turns it back to Violet.
How do I Unfollow a hyperlink?
Sundog
-
- Administrator
- Posts: 78493
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)
Re: Unfollow a Hyperlink color
Hans, I don't quite understand how this applies. I'm in Word, not in a browser. All my hyperlinks are internal to the same Word document. Sorry if I didn't make that clear initially.HansV wrote:Try clearing your browser history.
Sundog
-
- Administrator
- Posts: 78493
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)
Re: Unfollow a Hyperlink color
That worked, thanks. That's a nuisance for large documents or if in the middle of a correction ; no other snazzy VBA way?
Sundog
-
- Administrator
- Posts: 78493
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Unfollow a Hyperlink color
I don't think there is another way to restore a hyperlink to its pristine state, but why would it be important to do so while editing a document?
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)
Re: Unfollow a Hyperlink color
If I am in the middle of a correction that is in my mind but not yet down on paper/entered into the document, need I wait to stop my brain churning, Save the document, Close the document, Open the document, find where in this large document I was, re-engage my brain, and put my fingers back to work?
Sundog
-
- Administrator
- Posts: 78493
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Unfollow a Hyperlink color
Sorry, that's not what I meant. I don't quite understand why it would be essential to "unfollow" a hyperlink while you are busy editing the document. The hyperlink will act the same whether its state is "followed" or not.
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)
Re: Unfollow a Hyperlink color
It offends the eye and raises questions, if I'm sharing my editing session with an onlooker.
I'll explain that the color will change automagically upon closing and reopening the doc.
I'll explain that the color will change automagically upon closing and reopening the doc.
Sundog
-
- 5StarLounger
- Posts: 689
- Joined: 27 Jan 2010, 16:45
- Location: Ottawa, Ontario, Canada
Re: Unfollow a Hyperlink color
The following code will unfollow a link to the web. I leave it to you to expand the macro to other types of hyperlink. Call back if further assistance is required. The macro processes the first hyperlink in the selected range. I have tested this in 2003 and expect that it will work in 2007. Please let us know how it works out.Sundog wrote: How do I Unfollow a hyperlink?
Code: Select all
See following post.
Last edited by Don Wells on 19 Oct 2010, 15:33, edited 1 time in total.
Regards
Don
Don
-
- 5StarLounger
- Posts: 689
- Joined: 27 Jan 2010, 16:45
- Location: Ottawa, Ontario, Canada
Re: Unfollow a Hyperlink color
The following code upgrades that from my previous post to unfollow links internal to the host document.Don Wells wrote:Sundog wrote: How do I Unfollow a hyperlink?
Code: Select all
Option Explicit
Sub ResetLink()
Dim lngType As Long
lngType = Selection.Hyperlinks(1).Type
Select Case lngType
Case 0
Call ResetWebLink
End Select
End Sub
Private Sub ResetWebLink()
Dim varAddress As Variant
Dim varSubAddress As Variant
Dim varLabel As String
With Selection
With .Hyperlinks(1)
.Range.Select
varAddress = .Address
varSubAddress = .SubAddress
varLabel = .TextToDisplay
.Delete
End With
.MoveRight wdCharacter, Len(varLabel), wdExtend
.Hyperlinks.Add .Range, varAddress, varSubAddress, , varLabel
End With
End Sub
Regards
Don
Don
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)
Re: Unfollow a Hyperlink color
Don, I encounter a 5941 error when I try to run your code on a trial document with a followed hyperlink:
Debug gives me the attached.You do not have the required permissions to view the files attached to this post.
Sundog
-
- 5StarLounger
- Posts: 689
- Joined: 27 Jan 2010, 16:45
- Location: Ottawa, Ontario, Canada
Re: Unfollow a Hyperlink color
Are you certain that your selection included or was part of the hyperlink? The error code says that it did not.Sundog wrote:Don, I encounter a 5941 error when I try to run your code on a trial document with a followed hyperlink:.
Regards
Don
Don
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)
Re: Unfollow a Hyperlink color
Ah so. This time I did a Ctrl+A, and got a 5824 error, .Hyperlinks.Add .Range, varAddress, varSubAddress, , varLabel highlighted.
Sundog
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)
Re: Unfollow a Hyperlink color
Here is my test doc.
You do not have the required permissions to view the files attached to this post.
Sundog
-
- 5StarLounger
- Posts: 704
- Joined: 28 Jan 2010, 22:47
- Location: Alien Country (Roswell NM)
Re: Unfollow a Hyperlink color
Despite the 5824 error, when I return to my test document, the hyperlink HAS been reset to unfollowed. So something good IS happening.
Sundog
-
- 5StarLounger
- Posts: 689
- Joined: 27 Jan 2010, 16:45
- Location: Ottawa, Ontario, Canada
Re: Unfollow a Hyperlink color
Sorry; but I can find no problems when testing your file in Word 2003. Perhaps one of our Loungers with 2007 can offer some comment.Sundog wrote:Despite the 5824 error, when I return to my test document, the hyperlink HAS been reset to unfollowed. So something good IS happening.
Regards
Don
Don
-
- Administrator
- Posts: 78493
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Unfollow a Hyperlink color
I get the same error as Sundog in Word 2007. If I modify the code slightly, Word crashes.
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 689
- Joined: 27 Jan 2010, 16:45
- Location: Ottawa, Ontario, Canada
Re: Unfollow a Hyperlink color
I guess that we must put this down to the price of progress as defined by MicroSoft.HansV wrote:I get the same error as Sundog in Word 2007. If I modify the code slightly, Word crashes.
Regards
Don
Don