Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-05-2019, 04:01 PM
gmaxey gmaxey is offline VBA to convert a line of text to title case Windows 10 VBA to convert a line of text to title case Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

I can't see any relevance between the code you have posted and the object you are after. What does "^+" have to do with Em dashes? What does .Font.Bold = True have to do with Title Case? What is all that gibberish about If .Find.Found?





If your text is like your example (all terms constitute as single paragraph then:

Code:
Sub ConvertToTC()
Dim oRng As Range
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .Text = ChrW(8212)
    While .Execute
      With oRng
        .End = .Paragraphs(1).Range.End
        .Start = oRng.Start + 1
        .Case = wdTitleWord
        .Collapse wdCollapseEnd
      End With
    Wend
  End With
lbl_Exit:
  Exit Sub
 End Sub

BREAK


Paul, what makes an "Expert" in this forum?
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA to convert a line of text to title case How do I convert a line of text to title case? neilfxb Word 21 02-22-2023 12:47 PM
Macro that formats (true title) case by Heading style Marrick13 Word VBA 11 09-20-2015 06:29 PM
VBA to convert a line of text to title case Customising a style that uses Title Case formatting Madanjeet Word 6 05-18-2015 10:11 AM
Stop review query when small case at beginning of line dsrose Word 2 01-22-2014 12:19 AM
VBA to convert a line of text to title case True Title Case for First Row of All Tables Marrick13 Word VBA 14 12-11-2013 09:12 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:52 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