![]() |
#25
|
||||
|
||||
![]()
Try:
Code:
Sub SpaceToUnderscore() Application.ScreenUpdating = False Dim StrFnd As String, StrRep As String With Selection.Range StrFnd = Trim(.Text) .Case = wdTitleWord StrRep = Replace(Trim(.Text), " ", "_") End With With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Text = StrFnd .Replacement.Text = StrRep .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute Replace:=wdReplaceAll End With End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Ulodesk | Word | 2 | 01-03-2011 11:43 AM |
![]() |
lwisniewski | Word VBA | 3 | 12-24-2010 03:45 PM |
![]() |
markg2 | Outlook | 2 | 04-26-2010 03:09 PM |
How do you combine two contact folders? | waikoloavrm | Outlook | 0 | 04-12-2010 02:31 PM |
Bulletizing one paragraph affects all paragraphs | GoodWebby | Word | 0 | 10-10-2009 12:09 PM |