![]() |
|
#1
|
|||
|
|||
|
First, I am not the first person to ask this question - it was asked and answered here: Deleting all text except text of a certain font size
My situation is virtually identical to that of the original poster: I'm copying a .pdf file to word, and need to delete all footnotes - which show up in a smaller font size. So I need to delete all text NOT in font size 12. This was the non-VBA solution proposed: Quote:
|
|
#2
|
|||
|
|||
|
Aha - found an even simpler solution:
• use find/replace to highlight all text in font size 12 • use find/replace to delete all non-highlighted text But still need to figure out how to save this to a macro . . . |
|
#3
|
||||
|
||||
|
Try:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
.Font.Hidden = True
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Font.Size = 12
.Replacement.Text = ""
.Replacement.Font.Hidden = False
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.Execute Replace:=wdReplaceAll
.ClearFormatting
.Replacement.ClearFormatting
.Font.Hidden = True
.Execute Replace:=wdReplaceAll
End With
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#4
|
|||
|
|||
|
Ohmygosh - that's amazing! THANK YOU!!!
And that gives me enough info to be able to manipulate other font features as well - thank you so much! Just one question for you - what's the purpose of this pair of commands? Application.ScreenUpdating = False Application.ScreenUpdating = True I haven't seen them before, and the macro seems to run just as well with or without them. Perhaps they're for a later version of Word? |
|
#5
|
||||
|
||||
|
Those commands prevent Word from repaginating and refreshing the screen while the macro is running. Whilst not necessary, in a big document when near the end of the file, this can save noticeable time while the macro is running.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
#6
|
|||
|
|||
|
Okay, got it - thanks!
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Balloon Text font and size macro
|
Artimae | Word VBA | 5 | 11-16-2017 05:20 PM |
| Insert Text with specific Font Size | Nick70 | PowerPoint | 1 | 08-10-2016 09:56 AM |
Deleting all text except text of a certain font size
|
JustAboutNoon | Word VBA | 3 | 10-09-2014 10:21 AM |
Font size of track changes balloon text
|
Oryctolagus | Word | 1 | 11-13-2013 09:27 AM |
| making text (size/font) non editable in CONTROLS box....possible? | bjsa06 | Word | 2 | 09-22-2013 09:58 PM |