Ein Kommentar

Use INCLUDEPICTURE Field-Code in Microsoft Word for cool Letterheads and workaround some issues

In Microsoft Word you can do very cool stuff using Field Codes (Formulas). For example you could create a condition to show a Picture and with a few of them you’ll have a nice Picture Randomizer for your Document Header and Footer.

After you finished such an amazing Field Code you probably want to reuse it in other Documents but ran into some issues. Even in small documents Microsoft Word might become not responding, show totally or partially blank Pages or other strange display Issues. I’ll explain you what it causes and how to work around it.

The cool thing

We created a Word Template which looks similar to this simplified one:

That’s quite cool but requires no Macro! The Field Codes are like:
{ IF { =MOD({ PAGE }; 3 } = 0 { INCLUDEPICTURE „C:\\Letterhead\Blue.png“ } }

The ugly thing

If you use Word 2010 and copy and paste these to another document it looks ok for the first moment. But as soon as people start to work with it, they might get these issues:

The document looks wrong when you scroll, zoom in/out or type. During that the CPU usage might be very high which indicates a performance issue. If you Press ALT + F9 to Toggle the Field Codes you’ll see there’s something wrong:

Word 2010 just replaces the INCLUDEPICTURE Code with the actual picture which causes that issues.

The fix

To fix this issue you can either write the Formula again and again in Word 2010. Paste alternate didn’t work for us.

Or you can use Word 2013 where Copy and Paste works as expected. You can then save the File again as Word 2010 Document (check Maintain compatibility with previous versions of Word).

Attention

If you use Word 2013 (or maybe Word 2015) and open an older Word Document in Compatibility Mode, ensure to save it with Maintain compatibility with previous versions of Word checked. If you don’t you get a warning about “some minor layout changes are possible”. If you ignore that, you run into the same issue that INCLUCEPICTURE gets changed after saving!

PS: if you check “Do not ask me again” you can’t undo this in any settings. It’s stored binarily in the Windows Registry at HKCU\Software\Microsoft\Office\15.0\Word. Just rename or remove that key.

Über Benjamin Gemperle

Web Developer bei 2sic Internet Solutions GmbH seit 2006. Entwickelt Software-Lösungen mit Web-Standards und Microsoft-Technologien. Mein Daily Business: SharePoint, DNN, AngularJS, ASP.Net, C#, SQL Server, IIS, InfoPath, Access, Excel, PowerShell sowie gängigen Web-Sprachen HTML, CSS, JavaScript (jQuery, AngularJS), AJAX, XML, XSL/XSLT. Mein Ausgleich: Reisen, Natur, fein Kochen und Essen, Fitness, Biken, Skiing.

Ein Kommentar zu “Use INCLUDEPICTURE Field-Code in Microsoft Word for cool Letterheads and workaround some issues

  1. Hi there,

    I was so glad when I found this page. Thus I finally got the explanation what is going wrong with our Word documents here.
    So +1 for pointing out this issue.

    For the fix: I was not satisfied with the work-arounds provided here and started digging by myself. In the end I found a Word 2010 work-around that I would like to share here:

    You can „Insert“ an „Object“ as a „Bitmap Image“ which opens a MS Paint instance where you can paste your image. The code { EMBED Paint.Picture } and the result work just fine within headers and footers.

    Kind regards
    Strix

Schreibe einen Kommentar

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s

%d Bloggern gefällt das: