Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-18-2018, 07:58 AM
nhcowboy1 nhcowboy1 is offline Delete all text except text of a certain font size Mac OS X Delete all text except text of a certain font size Office 2004 for Mac
Novice
Delete all text except text of a certain font size
 
Join Date: Mar 2018
Posts: 8
nhcowboy1 is on a distinguished road
Default Delete all text except text of a certain font size

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:
Originally Posted by Macropod
• mark all the text as hidden
• use Find/Replace to find all text in your attribute and format as unhidden
• copy the document, then use Paste Special>Unformatted text. This will delete all the hidden text. What remains is the text in your attribute.
Works brilliantly . . . but I really need to save it to a macro (in Word 2004), and have no idea how to do that.
Reply With Quote
  #2  
Old 03-18-2018, 09:45 AM
nhcowboy1 nhcowboy1 is offline Delete all text except text of a certain font size Mac OS X Delete all text except text of a certain font size Office 2004 for Mac
Novice
Delete all text except text of a certain font size
 
Join Date: Mar 2018
Posts: 8
nhcowboy1 is on a distinguished road
Default

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 . . .
Reply With Quote
  #3  
Old 03-18-2018, 02:27 PM
macropod's Avatar
macropod macropod is offline Delete all text except text of a certain font size Windows 7 64bit Delete all text except text of a certain font size Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #4  
Old 03-18-2018, 05:02 PM
nhcowboy1 nhcowboy1 is offline Delete all text except text of a certain font size Mac OS X Delete all text except text of a certain font size Office 2004 for Mac
Novice
Delete all text except text of a certain font size
 
Join Date: Mar 2018
Posts: 8
nhcowboy1 is on a distinguished road
Default

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?
Reply With Quote
  #5  
Old 03-19-2018, 01:57 PM
Guessed's Avatar
Guessed Guessed is offline Delete all text except text of a certain font size Windows 10 Delete all text except text of a certain font size Office 2013
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,992
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
  #6  
Old 03-19-2018, 02:18 PM
nhcowboy1 nhcowboy1 is offline Delete all text except text of a certain font size Mac OS X Delete all text except text of a certain font size Office 2004 for Mac
Novice
Delete all text except text of a certain font size
 
Join Date: Mar 2018
Posts: 8
nhcowboy1 is on a distinguished road
Default

Okay, got it - thanks!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete all text except text of a certain font size 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
Delete all text except text of a certain font size Deleting all text except text of a certain font size JustAboutNoon Word VBA 3 10-09-2014 10:21 AM
Delete all text except text of a certain font size 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

Other Forums: Access Forums

All times are GMT -7. The time now is 05:19 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft