Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-10-2013, 10:42 PM
bpanda bpanda is offline A recurring word count macro? Mac OS X A recurring word count macro? Office for Mac 2011
Novice
A recurring word count macro?
 
Join Date: Jan 2013
Posts: 3
bpanda is on a distinguished road
Default A recurring word count macro?

I managed to copy this macro from a website (forgotten which one):

Sub Section2WordCount()
' Section2WordCount Macro
' This macro counts the number of words in Section 2
' and prints it at the Bookmark named "WordCount"
' Counting is done by Format(.Sections(2).Range.ComputeStatistics(wdStat isticWords))
' which filters the command through the WordCount subroutine

Dim oRange As Word.Range
Dim sBookmarkName As String
Dim sTemp As String



sBookmarkName = "WordCount"
With ActiveDocument
sTemp = "( " + Format(.Sections(2).Range.ComputeStatistics(wdStat isticWords)) + " words)"
Set oRange = .Bookmarks(sBookmarkName).Range
oRange.Delete
oRange.InsertAfter Text:=sTemp
.Bookmarks.Add Name:=sBookmarkName, Range:=oRange
End With

End Sub

It's a really cool macro. Does anyone here know how to modify this macro so that it will do a word count for every section in a Word document and print the results at the end of the section?

Many thanks.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Word Count Richtriebe Word 1 04-20-2013 11:09 AM
A recurring word count macro? Word Count Macro bpanda Word VBA 1 01-11-2013 06:51 PM
A recurring word count macro? Where did live word count go? Tango Mike Word 3 08-01-2012 09:34 PM
*Word 2007 Macro for Character Count gbartlet Word 0 07-21-2010 11:12 AM
FInd recurring words in Word 2003 NJ007 Word 4 01-25-2010 03:11 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:48 AM.


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