- Insert qr code in word document how to#
- Insert qr code in word document pdf#
- Insert qr code in word document download#
- Insert qr code in word document windows#
Insert qr code in word document download#
Give people a brochure or a catalog of your company’s offerings to download or provide them unique discount codes or coupons they can use at your store.
It could be a white paper, terms and conditions, reports, relevant documents you need to be signed and returned.
Insert qr code in word document pdf#
Link to a PDF that has valuable information people can use.
Insert qr code in word document how to#
Set BinaryStream = CreateObject("ADODB.Stream")īinaryStream.Upload a PDF file to a QR code that contains instructions on how to assemble a product. ScriptEngine.AddCode "function encode(str) "Įncoded = ScriptEngine.Run("encode", str)įunction SaveBinaryData(FullName As String, ByteArray) ' This came from ' which also shows some other ways to do the encoding ' But we also get a bytearray back so we can use ADOĬall SaveBinaryData(FullName:=FullName, ByteArray:=.ResponseBody)ĭebug.Print encodeURL("Cirinnà, Abbascià")įunction encodeURL(str As String) As String ' which is an Istream but I think that is a little bit hard ' We might be able to use the ResponseStream property of the request ' FileSystemObject is not a good choice for binary data ' in this example we want to save the response, Option(WinHttpRequestOption_EnableHttpsToHttpRedirects) = True Option(WinHttpRequestOption_EnableRedirects) = True Option(WinHttpRequestOption_UserAgentString) = "Test QR code retrieval" URL:=QRServerUrlStem & "?data=" & encodeURL(TextToEncode) & "&size=100x100", _ Set request = CreateObject("WinHttp.WinHttpRequest.5.1") ' This is the URL of an example text-to-QR code web service R.Collapse Direction:=įunction getQRCode(TextToEncode As String, FullName As String) ' Insert the image at the end of the document ' and you may need to replace constant names by their valuesĬonst QRImageFile As String = "c:\a\qrimage.png"Ĭonst TextToEncode As String = "Cirinnà, Abbascià"Ĭall getQRCode(TextToEncode:=TextToEncode, FullName:=QRImageFile) ' objects you normally have to change declarations such as ' To distribute code that may use different versions of referenced ' and using Word's insertXML method to insert the image, but ' Finally, in the scenario you describe, you might need ' or something like it is probably unavoidable. ' However, I do not think the HTTP control ' so you should probably avoid that if possible ' will not work on 64-bit versions of Word ' There are also other ways to do the URL Encoding and the. ' so yoou should probably avoid that if possible ' There are other ways you can save to disk without using ActiveX Data Objects ' None of the above are available on Mac. ' Microsoft Script control (msscript.ocx) ' (I happen to be using version 6.1, which is in msado15.dll) ' Microsoft WinHTTP Services, version 5.1 (in winhttpcom.dll) ' To issue the request and retrieve the result:. ' The references you need are as follows:
Insert qr code in word document windows#
' But the code will only work on Windows systems that have those objects ' You will need to make references to all these objects via ' This sample actually uses 3 Windows COM objects to do this, and also ' your users to understand that they are sending data to a 3rd-party ' what their terms and conditions are, and you will probably need ' to use any such service for real, you obviously have to find out
' insert the file at the end of the document ' build a request URL tht specifies the text and the size of the QR code ' convert the text to a "URLencoded" format ' This is just an example of how you could use a I do not know whether it is suitable for your needs). I have provided some sample code that shows how to access one such service (This is just the first service I came across on Google Well, I have never done this, but since you can use VBA you may be able to use a web service to convert the text to a URL.
ORg.Collapse wdCollapseEnd ' location to insert field Unprotect ' include Password:="secret password" if needed ' cannot insert anything in a protected form, so unprotect The equivalent VBA code to insert a DISPLAYBARCODE field for the same text string should look like this:ĭim iHeight As Integer ' measured in twips (1 point = 20 twips)ĭim iCorrection As Integer ' valid values are 0 to 3