709-218-7927

The Landfall Garden House

60 Canon Bayley Road

Bonavista, Newfoundland

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

709-218-7927 CPRGreaves@gmail.com

Bonavista, Sunday, December 08, 2024 9:32 AM

Copyright © 1990-2024 Chris Greaves. All Rights Reserved.