Beeminding Microsoft Word Count


#1

Hi,

I have read the Beemind Your Writing blog post, and did not find a way to beemind writing using Microsoft Word.

So I thought about it, and here is the one that worked for me:
A keyboard shortcut in word will save the word count into a dropbox folder. IFTTT will send the wordcount to a beeminder goal.

Create a Macro with a keyboard shortcut in Microsoft Word:

1. Record Macro ->  keyboard
2. Assign : ctrl + D  (or any other shortcut that you want, but beware that it is not used by Word. Try the shortcut and it should not do anything before creating this macro)
3. Type something 
4. Stop recording macro
5. Macros ->  Click on Visual Basic
7. Your macro will be at the end
8. Delete the code that is generated from your typing

Put instead the following code:

Dim TextFile As Integer
Dim FilePath, FolderPath As String
Dim wordcount As Long

wordcount = ActiveDocument.Range.ComputeStatistics(wdStatisticWords)

'What is the file path in your dropbox account?
FolderPath = "E:\internet related\Dropbox\word_count\"
  
FilePath = FolderPath + Str(wordcount)

' Delete all files inside that folder, so you will write the new file with the latest word count
Kill FolderPath + "*.*"

TextFile = FreeFile

'Open the text file
Open FilePath For Output As TextFile
  
'Save & Close Text File
Close TextFile

Create an IFTTT goal:
Dropbox when a new file created inside a subfolder -> Beemind the file name

I hope it is useful for folks using Word.

Update
I have made few changes to the code to make it works as differential word counter. It will count the number of words typed after your last macro run.

This mode has several Pros over the older code which beeminded the cumulative total word count of the file.

Pros of differential word counter vs cumulative

  1. Can work on multiple word files with only one writing Beeminder goal. Even if the word files have different folder paths. This method depends on using Macro that is available everywhere when you work on your Word application, and not on the path of your word file.
  2. Can work when you want to continue writing, even if the writing project started before creating the beeminder goal, and your intention to beemind your effort every session, rather than the total word count of the word file.
  3. If you copy paste a chunk of text and do not want to include it in your word count, you can copy paste it -> save word and exit -> open it again (it will reset the differential count and you can continue writing and effectively skipped beeminding that pragraph that you have pasted
  4. A one line code can be uncommented to ignore negative wordcounts, in case that is desirable when you want to ignore deletions. Please remember to run the macro after deleeting a significant chunk of text so that it will count your typing after that deletion.

You can find the code here with Readme file how to use it.


#2

Genius! Thank you for sharing this! Of course I’d really like to support this natively and make this moot. :blush:


#3

The Beeminder userbase is so clever :).


#4

That would be great. The only way I can see this possible is to develop an addon in Microsoft Word with a proper Beeminder API usage.

Or perhaps there is another way by coding a program for reading a Word file and counting the words (in a technique that I am not aware of).

By the way, I made the code better to folks who want to beemind the differential word count rather than the cumulative word count. I have updated my first post to include the link to the Github repo.