View Single Post
 
Old 07-25-2025, 08:54 AM
brucemc777 brucemc777 is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: Jul 2014
Location: Fredericksburg, VA
Posts: 48
brucemc777 is on a distinguished road
Default Select text, click button, hyphens replace spaces

I must be trying to achieve something rather useless because the only code i can find for this is:
Code:
Sub HyphenateSelection()
    Dim rng As Range
    Set rng = Selection.Range
    rng.Text = Replace(rng.Text, " ", "-")
End Sub
Whereupon i find Outlook does not use the Range Type. Either someone coded without testing or MS has once again "improved" their Outlook product.

Though i have a bit of a grasp with VBA in Excel, it looks like i'm blind in a forest bumping into trees when it comes to Outlook. Would any of you good folks help me out here?

Thank you for your consideration!

Best Regards,
-Bruce
Reply With Quote