Some users of the Army’s Electronic Benchbook have reported an unusual error message: benchbook error message

I’ve traced the problem to an error in the code that appears when using the 64-bit version of Microsoft Word. You can correct this problem yourself in just a few easy steps. Keep reading for an illustrated step-by-step guide to solve the problem.

Step 1: Open the Benchbook in Word. It is not necessary to enable macros.

Step 2: Hold down the Alt key and press F11. The Visual Basic for Applications window will open.

On the left you will see a navigation menu; click the + icon next to Benchbook2010TD (Benchbook2012) to expand the menu. Then do the same for Modules. Finally, double-click on CBB.

show macro

Note: If the windows that opens looks like the below image instead, don’t panic. Just click on the – icon next to Forms (circled below), then click the + icon next to Modules, followed  by a double-click on CBB.

this looks scary but isn't

Step 3: You’re now looking at the code for the Electronic Benchbook. The text in red (circled below) is the problem. It is a 32-bit function that doesn’t work in the 64-bit version of Word without some correction.

show functionStep 4: You’re going to edit the first line in red.

It says: Private Declare Function GetPrivateProfileString _

It needs to say: Private Declare PtrSafe Function GetPrivateProfileString _

Don’t worry about capitalization (it will auto-correct). Just click the text between “Declare” and “Function” and type in “ptrsafe” (no quotes, obviously). The text will change from red to a combination of blue and black to indicate that the function is now valid.

fix functionStep 5: Close the Visual Basic for Applications window. Then close Microsoft Word; don’t click save, just close Word. You will be prompted to save the macro. Do it.

save prompt

 You will then be prompted to save the changes and discard the digital signature. Do that too.

digital signature

That’s it.

Open the Electronic Benchbook again and give it a testdrive. It should work normally.

5 Responses to “Fix your Electronic Benchbook”

  1. Rodger Drew says:

    Will the modified function still work in the 32 bit version of Word?

  2. Zachary Spilman says:

    It should Sir. Particularly since it’s 32-bit code. Reference this knowledgebase article.

    Things get trickier when 32-bit and 64-bit variables are mixed, but that’s not the problem here.

  3. Phil Cave says:

    Odd, my 64 bitter has been working fine.  Does it matter which version perhaps? 

  4. Rodger Drew says:

    It’s surprising that more problems have not arisen.  This code was originally written by COL Keith Hodges (when it was the “Computer Benchbook”… the “CBB” seen in the code) in the mid to late 90’s and substantially rewritten by me around 2001 through 2004 to add the current so-called “Thumb Drive” (“Benchbook[date]TD”) version.  Other than adding and updating instructions, the underlying code has been essentially unchanged since then.

  5. Zachary Spilman says:

    If done right the first time, code will usually run perfectly well for decades. But there are dangers in exploits (not an issue in the benchbook) and changes in the platform (what’s happening here). As well as others I’m sure, but I’m the non-programmer in the family.

    Phil, I suspect you’re running the 32-bit version of Word on a 64-bit system. It’s better to run the 32-bit version as a general rule (for compatibility), unless you need a 64-bit function (like a spreadsheet that needs more than 2 GB of memory; not likely in our business).