Data Matrix Barcodes in Adobe InDesign using Data Merge
Data Matrix 2D Barcodes in Adobe InDesign using Data Merge
- This tutorial shows how to create QR Code 2D barcodes in Adobe InDesign using an Excel file as a data source.
![](https://media.barcodewiz.com/images/30e0c5d9-1d96-4bf4-b8ec-cccc16df7f2e-DM-InDesign-THUMB.png)
Step 1A. Import module into Excel
- Click on Developer tab, select Visual Basic, or press ALT + F11 on keyboard
![](https://media.barcodewiz.com/images/dd2abe2e-0a13-4330-a3f9-2cdc9ece6c65-DM-InDesign-001.png)
- Right-click the Excel Object and select Import File...
![](https://media.barcodewiz.com/images/46ae1f4c-b68f-4c15-99e4-bab6927d4bbf-DM-InDesign-002.png)
- Select BarCodeWizDataMatrix.bas.
- The default location of the file is:
C:\Program Files\BarCodeWiz\BarCodeWiz Data Matrix Fonts
![](https://media.barcodewiz.com/images/36131079-6e5c-4c32-a706-fec9a81fd13e-DM-InDesign-003.png)
- The following module should now be part of the Access file.
![](https://media.barcodewiz.com/images/25ebc92c-2344-42b2-9617-3c7e755b1c21-DM-InDesign-004.png)
Change the line:
DataMatrixEncode = bcwiz.Encode(strBarcode, symbolSize, dataMatrixEncoding, allowSpecialChars, isGs1, quietZoneWidth, borderWidth, characterEncoding)
to:
DataMatrixEncode = bcwiz.Encode(strBarcode, symbolSize, dataMatrixEncoding, allowSpecialChars, isGs1, quietZoneWidth, borderWidth, characterEncoding,"@")
(Add "@" at the end of paragraph)
![](https://media.barcodewiz.com/images/9151c625-8748-4219-97a9-b1b9ef5e7b40-DM-InDesign-005.png)
Step 1B. Prepare the data to be merged
- Open the Excel file with data to convert or enter the values. Our example has the following data:
![](https://media.barcodewiz.com/images/7f981502-207f-40f4-b65d-1b32b476b05d-DM-InDesign-006.png)
- Use the function =DataMatrixEncode
![](https://media.barcodewiz.com/images/fa668bff-a707-44d9-9a12-374af263f187-DM-InDesign-007.png)
Save the file as Text (Tab Delimited), or CSV UTF-8 (Comma Delimited) format
- Click on File > Save As
- For InDesign versions older than 2022 Select CSV UTF-8 (Comma delimited) and enter the name of the file: DataMatrix_merge_data.csv. Or simply save the file as Text (Tab Delimited), or Unicode Text.
- Close Excel. Otherwise, InDesign will not import the file.
![](https://media.barcodewiz.com/images/c401b8d0-ffb1-4277-85fa-08a4a91c5f5a-DM-InDesign-008.png)
Step 2. Start Data Merge in Adobe InDesign
- Click Window > Utilities > Data Merge
![](https://media.barcodewiz.com/images/79023b86-6655-4996-95d6-e7b0101eb043-DM-InDesign-009.png)
Step 3. Select Data Source
- Right-click the panel menu icon and click Select Data Source...
NOTE! Close Excel before importing the file. If the file is open, InDesign won't open it.
![](https://media.barcodewiz.com/images/9ef1b65b-efb8-4b55-adf6-0d4efc7d3d90-DM-InDesign-010.png)
- Browse for the file we saved in step 2 and click Open.
![](https://media.barcodewiz.com/images/2f97d8f7-312d-4a40-9f7c-9904c01911f4-DM-InDesign-011.png)
- The fields are now shown in the Data Merge panel.
![](https://media.barcodewiz.com/images/e7ea3ae6-6152-42be-9c77-612f2794800c-DM-InDesign-012.png)
- Insert text field into the document
![](https://media.barcodewiz.com/images/3a625264-bdc6-42df-9739-3d91b3fe0fb7-DM-InDesign-013.png)
Step 4. Create the Merged Document
- Click on the Create Merged Document button at the bottom of the panel.
![](https://media.barcodewiz.com/images/2413422b-1cef-4df6-a425-5450801f8674-DM-InDesign-014.png)
- Select which records to merge and click OK. We are selecting All Records here.
![](https://media.barcodewiz.com/images/6f537275-b284-4d35-8bc3-9d4f28d9dd15-DM-InDesign-015.png)
Step 5. Find the @ sign
- Press CTRL + F on your keyboard.
- Set Find what and Change to fields as presented.
![](https://media.barcodewiz.com/images/72ec406e-f64d-47a1-a44b-5acab407a885-DM-InDesign-016.png)
- With all the @ signs removed, the document should look like this
![](https://media.barcodewiz.com/images/f5922761-49ac-461b-9198-ae2662e7b8ac-DM-InDesign-017.png)
- Set the font to BCW_DM
- Font size to 12
- Line spacing to 12 (should be same as Font Point Size used).
NOTE: For smaller barcodes, you can set the point size as low as 2pt - set line spacing accordingly
![](https://media.barcodewiz.com/images/11529cdb-86b0-4cea-a4da-bd901da53e90-DM-InDesign-018.png)
Finished!
![](https://media.barcodewiz.com/images/cd75ba6a-b714-4222-8987-d747c94d78e4-DM-InDesign-019.png)