Fix for recurring Microsoft Word 2016 document opening/saving bug

Posted by Pierre Igot in: Microsoft
December 22nd, 2016 • 4:02 pm

Ever since I upgraded to Microsoft Office 2016 on my Mac, I have been experiencing this recurring bug.

Word 2016 works OK for many days. (I say “OK” and not “great” because Word never works great, even at the best of times.)

Then all of a sudden, for no apparent reason, it becomes unable to open or save documents. The application starts displaying all kinds of error messages, like the following:

word2016-cantopen

Alternatively, if you are in the process of working on an existing document that you’ve been saving regularly using Command-S until now, all of a sudden Word starts complaining that it can no longer save the document (which might leave you stranded if you made lots of changes since the last time you saved the document).

Sometimes, weird problems like this one can be remedied by quitting and relaunching Word. Not in this case, though. If you try to quit and relaunch Word, you then get the following message:

word2016-cantopentemplate

In other words, at this stage it looks like Microsoft Word 2016 has become unable to open any file, including its own Normal template file. To make matters even more scary, if you click on “OK” to continue and then try to quit Word the normal way, when trying to quit, Word displays the following error message:

word2016-cantopensavetemplate

Don’t click on “Yes”! (It won’t actually do anything, since Word is currently unable to open or save anything, but it’s still not a good idea.) If you click on “No”, Word still fails to quit. So at that stage the only option is to force-quit Word.

You can try this whole cycle multiple times just for fun if you want to, but whatever option you choose in those misleading error dialog boxes, nothing will work, and Word won’t go back to normal.

The whole problem happened to me again this afternoon. Normally, when it happens, I have found that the only solution was to reboot the entire computer. Today, however, I had a little time, so I decided to do more sleuthing.

My first reflex was to go to the Console and see if I could notice any error messages that might help better circumscribe the problem.

I first noticed that, even time I tried to relaunch Word, the system log would include something like this:

16-12-22 14:50:16,765 Microsoft Word[50336]: ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/sp/fgbr368s4_q5_rbzb_4k5w740000gn/T/com.microsoft.Word/com.microsoft.Word.savedState

So I figured that the problem might have to do with some kind of conflict between Word and OS X’s built-in application resuming feature, which normally causes an application to reopen the windows that were left open the last time the application was quit.

Of course, the irony here would be that OS X’s Resume (or “Persistence”) feature has never been supported by Microsoft. Word 2016 has never been able to reopen the windows that were left open the last time it was quit, even when the general setting in OS X’s System Preferences (under “General”) is as follows:

osx-resumesetting

Based on this message in the Console, Microsoft’s lack of support for this OS X feature clearly does not prevent OS X itself from trying to apply it to Word 2016, even if it does not do anything.

So my first troubleshooting step was to try and see if I should clear whatever “saved state” might linger in my system for Word 2016 and relaunch the application. I went to:

~/Library/Saved Application State/com.microsoft.Word.savedState/

and cleared everything inside that folder and tried to relaunch Word, but that didn’t work.

I then went to the exact location mentioned in that message in Console:

/var/folders/sp/fgbr368s4_q5_rbzb_4k5w740000gn/T/com.microsoft.Word/com.microsoft.Word.savedState/

and I cleared everything that was there and tried to relaunch Word, but that didn’t work either.

Finally, I tried to launch Word 2016 while holding the Shift key down. This did make a difference, in that Word 2016 no longer displayed the message saying that it was unable to open the Normal template. But that’s easily explained if you consider that starting Word up while holding the Shift key down effectively launches Word in a so-called “safe” state, for troubleshooting purposes. In that “safe” state, Word no longer tries to open the Normal template, in case the template itself is the source of whatever trouble you are trying to address. (It is not the source of the trouble in this case, which can be demonstrated by the fact that the whole situation is resolved by simply rebooting the entire system. After that, Word 2016 works fine again, with the same Normal template.)

After launching Word 2016 successfully in a “safe” state, however, I found that it was still unable to open files. So the problem was not fixed.

Basically, this whole process suggested that the problem had nothing to do with OS X’s Resume/Persistence feature and couldn’t be fixed by fiddling with the folders involved in that feature, and that the error message in the Console didn’t really mean anything significant. (I was able to confirm this later on by finding that the error message still appeared upon launching Word even when Word was working normally again.)

I then paid closer attention to the other references to Microsoft Word in the system log in the Console, and found multiple occurrences of another suspicious-looking message:

16-12-22 15:43:17,268 Microsoft Word[61532]: NSAllowAppKitWeakReferences=YES

I had no idea what it meant, but I decided to try and find out if anyone online had ever referred to this “NSAllowAppKitWeakReferences” variable in the context of troubleshooting Word 2016.

I first found a thread on Apple Discussions, but that thread discussed a different problem (Microsoft Error Reporting quitting unexpectedly) and nothing is the thread was helpful in my situation.

Then I found this thread on the Microsoft Community forum for Office 2016 for Mac. It contained lots of the usual bullshit about things being Apple’s fault, Microsoft allegedly having fixed (or not fixed) the problem, Microsoft allegedly having noted that multiple users were reporting the problem and being supposedly working on a solution, Microsoft not being involved in these “user-to-user” discussion forums even though a user named “Erik J” had “[MSFT]” appearing next to his name, etc.

And then I saw the very last message in the thread, from that Erik J who might or might not work for Microsoft, who mentioned the following troubleshooting steps:

  1. Close Word.
  2. Click the magnifying glass icon in the top right corner of your screen, type Terminal, and press Return.
  3. In the Terminal window that opens, type the following and press Return: defaults write com.microsoft.Word ForceTempFilesInAppContainer 1
  4. To ensure that this setting worked,
    • Open a Finder window, and press Command+Shift+G.
    • Type the following path: ~/Library/Containers/com.microsoft.Word/Data/Library/Application Support/Microsoft/Temp
    • Press Return. Upon launching Word, this folder will be created if it doesn’t exist, and Word will create a temp file inside it. Quitting Word will then cause this temp file to removed, which tells us that the new setting has taken effect.

I don’t really know what this does, but I tried it this afternoon on my machine after Word 2016 started acting up and refusing to open or save any file, and… it fixed the problem!

After typing the above-mentioned defaults command in Terminal and relaunching Word, I found that it was back to normal, able to open the Normal template without trouble and able to open and save files as expected.

Given that Erik J does not give any further information and that it is the last post in the thread (dated August 19, 2016), I don’t know if it’s a permanent fix or a temporary one, or if it’s even meant to be a fix. All I know is that it seems to work on my machine for my copy of Word 2016, and that this seems to indicate that, if the problem occurs again, I might be able to fix it without having to reboot my entire machine, which is of course a significant relief.

One ironic aspect of the whole process is that, after all this, I discovered that, even when Word 2016 was back to working normally again, it still caused the recurrence of the NSAllowAppKitWeakReferences=YES error in the system log. So maybe that error in itself doesn’t mean anything either, but actually just guided me to the right forum.

I will post a link to this blog post on the forum at the end of that discussion thread, and maybe Erik or someone else at Microsoft will notice it and maybe (yeah right) get back to me with a request for more information or a confirmation that this is a fix (and that it will be included in a future update). Whatever happens, I figure the most useful thing that I can do for fellow Word 2016 users is to write about the whole thing in a blog post, so there you are.


Comments are closed.