![]() |
#3
|
||||
|
||||
![]()
Hi Powerdrum,
Try: Code:
Sub Demo() Dim MyData As DataObject, strClip As String, i As Long Set MyData = New DataObject With ActiveDocument.Content With .Find .ClearFormatting .Text = "" With .Font .SmallCaps = False .AllCaps = True End With With .Replacement .Text = "" .ClearFormatting End With .Forward = True .Wrap = wdFindStop .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute End With Do While .Find.Found .Copy MyData.GetFromClipboard .Text = MyData.GetText .Collapse wdCollapseEnd .Find.Execute Loop With .Find .Wrap = wdFindContinue With .Replacement.Font .SmallCaps = False .AllCaps = False End With .Execute Replace:=wdReplaceAll End With End With End Sub Alternatively, you might prefer this simplified version, which doesn't need a reference to the MS Forms object library: Code:
Sub Demo() With ActiveDocument.Content With .Find .ClearFormatting .Text = "" With .Font .SmallCaps = False .AllCaps = True End With With .Replacement .Text = "" .ClearFormatting End With .Forward = True .Wrap = wdFindStop .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute End With Do While .Find.Found .Cut .PasteSpecial DataType:=wdPasteText .Collapse wdCollapseEnd .Find.Execute Loop End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
icsjohn | Word VBA | 2 | 12-07-2011 06:44 PM |
![]() |
vhindley | Word | 3 | 07-08-2011 03:39 AM |
Why the "Headings" are appearing in capital letters in the Table of contents? | Jamal NUMAN | Word | 1 | 05-31-2011 08:31 AM |
safe sender list not workin | LA1976 | Outlook | 0 | 05-23-2011 03:27 AM |
MS Project able to import actual start and or actual finish date from Excel? | mhacker | Project | 0 | 04-26-2010 11:29 AM |