Excluding Zotero in-text references from word count

How do I exclude the in-text references (Harvard) from my word document word count?
  • Bump. All the macros posted on the MS Office site use Word's built-in citation and referencing types, so I'm manually doing this. A macro will be very helpful.
  • Having been unable to find a macro, I spent my morning customising various realted ones I found on the internet. The macro below will give you a word count, minus Zotero in text citations and the bibliography, and will also remove the word count for tables and captions. It's slightly clunky, and might give false results if you use any other Add-ins apart from Zotero in your Word document.
    When I pasted it in below, some of the lines wrapped, and the indentation got lost, so you might want to manually fix this when you create it as a macro.

    Sub ExcludeTableCaptionAndZoteroWordsFromWordCount()
    Dim objTable As Table

    Dim objParagraph As Paragraph

    Dim objDoc As Document

    Dim nTableWords As Integer

    Dim nDocWords As Integer

    Dim nWordCount As Integer

    Dim nCaptionWords As Integer

    Dim Fld As Field

    Dim nZoteroWords As Integer

    Set objDoc = ActiveDocument

    nTableWords = 0

    nCaptionWords = 0

    nZoteroWords = 0

    nDocWords = ActiveDocument.ComputeStatistics(wdStatisticWords)



    With objDoc

    For Each objTable In .Tables

    nTableWords = nTableWords + objTable.Range.ComputeStatistics(wdStatisticWords)

    Next objTable

    End With



    With objDoc

    For Each objParagraph In .Paragraphs

    If objParagraph.Style = "Caption" Then

    nCaptionWords = nCaptionWords + objParagraph.Range.ComputeStatistics(wdStatisticWords)

    End If

    Next objParagraph

    End With

    With objDoc
    For Each Fld In .Fields
    With Fld
    If .Type = wdFieldAddin Then
    nZoteroWords = nZoteroWords + .Result.ComputeStatistics(wdStatisticWords)
    End If
    End With
    Next
    End With


    nWordCount = nDocWords - nTableWords - nCaptionWords - nZoteroWords



    MsgBox ("There are " & nWordCount & " main text words in this document." & vbCr & "The following items are excluded from word count: " & vbCr & "Total words in tables: " & nTableWords & vbCr & "Total caption words: " & nCaptionWords & vbCr & "Total Zotero citation and bibliography words: " & nZoteroWords)

    End Sub

    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
Sign In or Register to comment.