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, generates the bar code and finally pastes the bar code into the document replacing the selected text.
Note: B-Coder must be running when the following macro is run from within Word.
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