Sunday 13 January 2013

  GENERATING QR BAR CODE IN 2007/2010 WORD DOCUMENT




The objective of this blog is to represent an easy way to manually place a single QR code into Word document. So it’s making possible for a general user to simply type text in a notepad or any other text editor and generate its QR code in Microsoft word in a very easy way.

 Methodology :-  This blog consist several steps to create Qr code with ms word stroke scribe tool.these are as follows-
  
-->   A.  First of all download the StrokeScribe v3.9.2: setup.zip, so it can possible to generate barcode in a word document. You can generally download through this site-
  1. Now install it by simply double click on the setup.zip setup file.
  2. Create a text file and enter your text for which you want to generate your QR code for each line and save this file with QR.txt or any other name which you want to give it.
  3. Now open the Microsoft word.
  4. Now select the insert tab from menu bar of MS word 2007/2010.
  5. Now select the object tab from the toolbox and select again object from the drop down list.
  6. After selecting the object, a dialog box will be open with a list of object.
  7. Now Choose strokescribe document from list and click on the Ok button.
  8. After clicking the ok button, the following barcode will show on the current cursor position of the word document.
  1.   Now right click on it and choose view code from menu.
  2.  Now the Microsoft Visual Basic [Design] will open with a Document code window.
  3.  Now type the following code in it and run this code.
FileName = Application.ActiveDocument.Path + "\QR.txt"
     Open FileName For Input As #1
While Not EOF (1)
Input #1, txt 'read one line from QR.txt
Dim shape As InlineShape
Dim ss As StrokeScribe
Set shape = Selection.InlineShapes.AddOLEControl _
     ("STROKESCRIBE.StrokeScribeCtrl.1")
Set ss = shape.OLEFormat.Object
     shape.Height = 50
shape.Width = 50
ss.Alphabet = QRCODE 'create QR Code object
ss.Text = txt 'one line from txt file is encoded
ss.QRECL = Q 'medium-to-high error correction level
Wend
Close #1
  1. After run the program, the QR code will show in your Microsoft word document at the current cursor position like this.
  1. Now save the document with save type: Word Macro-Enabled Document.
  2. Algorithm for generating QR code for text file.
Step 1:- Open input FileName(QR.txt).
Step2:- Repeat step3 to step9 while EOF is not found.
Step3:- Read one line from input FileName and store it into txt.
Step4:- Set the shape for new Inlineshape object of Microsoft Word same as the strokescribe barcode object.
Step5:- Shape object of Microsoft Word is assign to the strokescribe object.
Step6:- Set strokescribe object’s Alphabet property to QRCODE.
Step7:- Set strokescribe Text property to txt.
Step8:- Set strokescribe object’s QRECL property Q.
Step9:-Go to step2.
Step10:-Close the input FileName.

Conclusion :-
-->
With the help of  this blog we can see  how to generate a QR code for any text file with using Microsoft Word tool strokescribe.A general user can generate his own QR code on a general application program by following the steps given in this article.