A client of mine is implementing Dynamics GP EFT for Payables (yay, no more cheques soon!)… and I needed to modify the Remittance Form that gets emailed to the vendors when they are paid. If nothing else, I needed to change the title “Check Remittance” to anything but the US spelling of cheque!
I did my modifications – pretty basic ones. I changed the title, I altered the size of a couple of header boxes to line some things up and removed some fields that the client didn’t need. (Who really needs Document Amount, Discount Amount, Net Amount and Amount Paid anyway?). Overall, pretty basic stuff, and nothing I hadn’t done before at other clients.
So, I finish my edits and import the template back into GP etc., and do an EFT run in the test company. I generate the remittances, and get a familiar error: “We can’t open ReportName.docx because we found a problem with its contents.”.
Typically, this means you’ve screwed up the template. I know that, and thought to myself, I was careful, I didn’t alter the placement of any sections and the changes were really straight forward. But, maybe I inadvertantly did something, so I deleted my template, exported a fresh unmodified one and made one simple change: Change the title from “Check Remittance” to “Payment Remittance”. I decided I wouldn’t redo all of the work but rather make changes one at a time until I come across the error again, so I can back up and not lose all of my work.
Imagine my surprise when I import this new template, run another test and get the same error!
I googled the error (oops, “Bing”, yes, I mean I binged the error of course!) and found lots of hits but everything really was about “hey, you screwed up the template dummy”). OK it didn’t really say that but you know, the gist was the template was compromised in some way.
You can see from the error above, the temp name incremented up to attempt #7 before I succumbed to posting a question about this on the Partner Technical Community site. I just couldn’t figure it out. I even exported the fresh, unmodified, out of the box word template for this report, did NOTHING to it, re-imported it, and I *still* got the error!
Wait, there’s more!
If that isn’t weird enough, it got a little more weird as I posted the question on the PTC site and then moved on to other testing and configuration while I waited for a response. As I was testing the full end to end process, including sending the email, lo and behold the Word doc attached to the email I could open without the error! This is the same workstation I’m working on, and emailing myself for testing, so it’s not a Word version difference or anything that would be obvious, except it’s one page vs. the version GP generates to screen (if you wish) during processing can be multiple pages if there are multiple payments in the batch.
If I generate the remittances during the Print Remittance process in GP, and choose to print the Remittance Form to screen, that’s when I get the error, on the opening of Word to display the remittances.
Andy Sather was kind enough to post a few options for me and luckily, one item specifically resolved my issue. Check out this blog post, and it’s the Maintain Compatibility setting that is what worked for me. This is verbatim the steps they describe that I performed and it worked perfectly after that.
The reason for this error is that the Maintain Compatibility Mode checkbox was not selected when the Template was saved the first time. Unfortunately Word only gives you the option to mark the Maintain Compatibility checkbox resaving the template does not bring it back. In the post the only option we had was to start over with a new Template.
The good news is I was able to work with Nathan Adams on the Word Team and he found a way to go back and mark the Maintain Compatibility check box. Below are the steps you can use to re-populate the Maintain Compatibility checkbox.
1. Open the template document then press Alt + F11.
2. In the VBA editor, go to View > Immediate Window.
3. In the immediate window (Pane at the bottom), type the following. You will need to alter the path and name of the Template based on where you have it saved.
activedocument.saveas2 filename:=”C:\users\myalias\desktop\doc1.docx”, compatibilitymode:=12
4. Press enter, and the code will execute immediately (which is why it is called the immediate window).
5. The file you have open will be renamed, in compatibility mode, and the new file will be on your desktop (or location that you have in the path).
6. Do a Save As on the Template, verify that the Maintain Compatibility checkbox is marked and then continue to import the Template back in through Template Maintenance.
This worked like a charm and the error went away!
Just for reference, the other options he mentioned were around images and to try removing images from Template Configuration entirely if the client used images. In my case, they do use images and have other Word Templates in use with those, so that wasn’t going to be a real option for them.
UPDATE: I didn’t realize when writing this, that Ian Grieve had run into the same thing and blogged about this thing as well. Thanks Ian! Here’s the link…