Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-19-2017, 08:40 AM
miguelholandes miguelholandes is offline How to count the words in black Windows 10 How to count the words in black Office 2013
Novice
How to count the words in black
 
Join Date: Mar 2017
Posts: 4
miguelholandes is on a distinguished road
Default

Hello,
I have to know how many words I have to translate in code that looks like this: (see attachment).

Now it looks like a mess but I only have to translate the words in black. But there are many long files, so counting the words in black manually would take way too long.




I thought this would do the trick, but no:

Code:
Sub countblackwords()
'
' countblackwords Macro
'
'
Dim wd As Range
Dim CountBlack As Long
    
CountBlack = 0
    For Each wd In ActiveDocument.Words
        If wd.Font.ColorIndex = wdBlack Then
           CountBlack = CountBlack + 1
        End If
    Next wd
    
MsgBox "Number of words in black: " & CountBlack

End Sub
Please, anybody help me?


Much appreciated,

Michiel
Attached Images
File Type: png howmanywordsinblack.png (217.1 KB, 25 views)
Reply With Quote
 

Tags
font color, loop through all words, vba microsoft word 2013



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to count the words in black Count words between quotation marks sojiro Word VBA 11 01-29-2017 12:59 PM
How to count the words in black Count number of words in closed docx files Pecoflyer Word VBA 2 11-25-2016 01:07 AM
PNG on black background printing transparency in different tone of black NMGMarques Word 0 03-03-2014 05:19 AM
How to count the words in black How can I count multiple usage of the same words? coffee_king Word VBA 1 03-24-2012 07:52 PM
How to count the words in black Creating Text to count words WITHOUT title page ingmar.s Word 3 10-08-2009 10:23 AM

Other Forums: Access Forums

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