> ## Documentation Index
> Fetch the complete documentation index at: https://support.taltech.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Convert selected text to a barcode (B-Coder Pro and Word)

> Use a Word macro that turns the text you select into a B-Coder Pro barcode, right in your document, without copying and pasting.

The following is a simple example of a Microsoft Word macro that copies the currently selected text to the clipboard, opens a DDE link to B-Coder Pro, generates the barcode and finally pastes the barcode into the document replacing the selected text.

**Note:** B-Coder Pro must be running when the following macro is run from within Word.

```vb theme={null}
 Sub MAIN()
' Copy the currently selected text to the clipboard
  Selection.Copy

 ' In Word 6.0 use the following instead of Selection.Copy:
 ' EditCopy


  ' Initiate DDE link with B-Coder
  Chan = DDEInitiate("B-Coder", "System")

  ' Create the bar code using data in the clipboard
  DDEExecute Chan, "[Paste/Build/Copy]"
  DDETerminate Chan ' Terminate the DDE link

  ' Paste the bar code into the Word document
  Selection.PasteSpecial DataType:=wdPasteMetafilePicture, Placement:=wdInLine
  ' In Word 6.0 use the following instead of the above
  ' EditPaste
End Sub
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.