709-218-7927

The Landfall Garden House

60 Canon Bayley Road

CANADA A0C 1B0

CPRGreaves@gmail.com

Home

Christopher Greaves

Convert Hyperlinks To Proper Case

Tuesday, November 29, 2011

I create small files "TableOfContents" for use in my web pages.

Christopher Greaves ProperCase_001.png

By mis-adventure I often enough end up with hyperlinks in a mish-mash of cases.

I'd like all the hyperlinks to conform to a consistent standard.

Sub ConvertHyperlinksToProperCase()

Dim HLNK As Hyperlink

For Each HLNK In ActiveDocument.Hyperlinks

With HLNK

Dim strTextToDisplay As String

strTextToDisplay = .TextToDisplay

.TextToDisplay = StrConv(strTextToDisplay, vbProperCase)

End With

Next HLNK

End Sub

This little macro does that.

Christopher Greaves ProperCase_002.png

Note that it processes EVERY hyperlink in the current document, which is fine for me.

If you wanted it to operate only on a selected area you could change one line to read

For Each HLNK In Selection.Hyperlinks

7092187927 CPRGreaves@gmail.com

Bonavista, Friday, December 04, 2020 5:54 PM

Copyright © 1996-2020 Chris Greaves. All Rights Reserved.