Pasting Windows Metafiles (Barcodes) into Office 2010

When barcodes are created in B-Coder, they are copied to the clipboard as Windows Metafiles. In many applications, including prior editions of Microsoft Office, pasting the barcode is as simple as selecting “Paste” or “Paste Special, Windows Metafile.” However, Microsoft Office 2010 uses the Enhanced Windows Metafile format by default as does not allow for an easily accessible option to paste an image as a standard Windows Metafile. This means that pasting Windows Metafiles into Word and Excel 2010 will not work correctly and the graphic will appeared to be broken and distorted. Your barcodes will not scan.

Some customers have reported this issue as fixed in Service Pack 2 for Microsoft Office 2010! Our own testing has corroborated this in most, but not all, cases. Please follow the link to the Microsoft website to download the latest service pack: http://support.microsoft.com/kb/2687455

If you cannot download Office 2010 SP2, we have created a simple macro that specifies “Windows Metafile” as the format and pastes the image into the document. To use our solution, you have two options. Again, only use the following options if you cannot download SP2

Option 1: Copy the PasteBarcode() code into your current Normal.dotm file

In Word 2010, open up the Visual Basic Editor under the Developer tab and insert a module in your Normal.Dotm document template. Copy the below subroutine into this module.

 Sub PasteBarcode()
   Selection.PasteSpecial datatype:=wdPasteMetafilePicture
End Sub

This subroutine can now be accessed by any document that you create or edit. Pasting the barcode from B-Coder is now as simple as copying the barcode (automatically copied to your clipboard when you build the barcode) and then running the macro in Word. A high quality barcode should now be in your document.

Option 2: Replace your normal.dotm file with one that we have created

To make this easier for you, we have created a normal.dotm file you may download. Simply replace your original normal.dotm file with this one. You can find the original normal.dotm by performing a system wide search or navigating to the following folder (must be able to view hidden files and folders):

C:Users(Your username here)AppDataRoamingMicrosoftTemplates

This automatically allows the above macro to be accessed by all Word documents. To assign this macro to a button, customize the Word quick launch bar or the ribbon interface.

Download normal.dotm

Place shortcut in the Quick Access Toolbar

If you followed the above instructions, you now have to open up the macro list and select “PasteBarcode” each time you wish to place a barcode in Word. If you plan on pasting barcodes often, you may wish to create a button in the ribbon interface, assign a hot key to paste the barcode or create a button in the Quick Access Toolbar. For the last option, creating a button in the Quick Access Toolbar, go to the “File” menu and select “Options.” In this new window, select “Quick Access Toolbar” as shown in the screenshot below. Choose commands from “Macros”, highlight “Normal.Module1.PastePicture” and click “Add >>”. To modify the icon, select “Modify…” from the right hand side after selecting the macro name in the list. We chose a checkerboard icon, but you can choose any icon that you wish. Press “OK”

 

You will now see the icon in the top left on the Quick Access Toolbar. Whenever you need to paste a barcode, simply press this button – it's that simple! Of course, you can create other buttons, including one directly in the ribbon interface, or assign a hot key to the macro. This is just one quick example.

Contact Us