Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 01-16-2017, 12:56 PM
macropod's Avatar
macropod macropod is offline Count words between quotation marks Windows 7 64bit Count words between quotation marks Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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
Dim i As Long, j As Long
With ActiveDocument
  j = .ComputeStatistics(wdStatisticWords)
  With .Range
    With .Find
      .ClearFormatting
      .Replacement.ClearFormatting
      .Text = "[“" & Chr(34) & "]*[" & Chr(34) & "”]"
      .Replacement.Text = ""
      .Forward = True
      .Wrap = wdFindStop
      .Format = False
      .MatchWildcards = True
      .Execute
    End With
    Do While .Find.Found
      i = i + .ComputeStatistics(wdStatisticWords)
      .Collapse wdCollapseEnd
      .Find.Execute
    Loop
    MsgBox "This document contains " & j & " words ," & vbCr & _
      "of which " & i & " (" & Format(i * 100 / j, "0.00") & _
      "%) are in quotes."
  End With
End With
Application.ScreenUpdating = True
End Sub
A different macro could be used for a defined range within the document and the simplest way to define that range would be by selecting it.

For PC macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm
For Mac macro installation & usage instructions, see: http://word.mvps.org/Mac/InstallMacro.html
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Straight Vs Curly Quotation Marks FOsmund Word 4 04-16-2015 01:48 PM
Quotation marks are inserted in wrong font sinz54 Word 5 01-11-2015 06:34 PM
Can't find space before closing quotation marks wardw Word 7 01-16-2014 12:13 PM
How do I select everything that is in quotation marks? Jophassa Word 4 09-02-2011 10:57 AM
Count words between quotation marks problem with automatic formatting on quotation marks Bobosmite Word 3 05-27-2010 07:06 PM

Other Forums: Access Forums

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