Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 06-09-2022, 08:29 AM
rollis13's Avatar
rollis13 rollis13 is offline A VBA macro can't get the correct color of a hyperlink in MS Word Windows 10 A VBA macro can't get the correct color of a hyperlink in MS Word Office 2016
Competent Performer
 
Join Date: Jan 2021
Location: Cordenons
Posts: 143
rollis13 will become famous soon enough
Default

Probably, since hyperlinks are 'fields' when you test the first character it picks the entire field returning '9999999 (hex 98967F) = undefined Font.Color' since the field has more colors.
Add these 2 lines and deactivate the other 2, run the macro and see the result in the "Immediate Window" Ctrl+G
Code:
'...
strHex2 = Hex(char.Font.Color)
cnt = cnt + 1                         '<- added
Debug.Print cnt & " = " & char.Font.Color & " = " & strHex2 '<- added
strHex3 = Hex(char.Style.Font.Color)
'...
'bFound = True                     '<- deactivated
'GoTo nt_lb                        '<- deactivated
'...
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to change an RGB table cell shading color to another RGB color David Matthews Word VBA 4 05-29-2018 02:45 PM
Correct Bookmark Hyperlink Phil H Word 2 02-10-2016 12:55 PM
A VBA macro can't get the correct color of a hyperlink in MS Word Word 2003 - Macro to color a row in table? cyberpaper Word 2 01-03-2013 02:07 PM
Word macro to email hyperlink pooley343 Word VBA 0 07-20-2011 01:48 AM
A VBA macro can't get the correct color of a hyperlink in MS Word Change Follwed Hyperlink color in Word 2010 Henry Word 1 07-05-2011 04:29 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:41 PM.


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