LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Report Gen Toolkit MERGEBARCODE issue

Solved!
Go to solution

Hello, 

 

I'm using the Report Generation Toolkit to create a printed label.  

 

The toolkit is pulling data from an Excel worksheet and populating bookmark fields on a Word Template file.  

 

Recently added a QR code to the label.  

 

Following instructions from Microsoft here: https://support.microsoft.com/en-us/office/field-codes-mergebarcode-812fc43f-cb53-4782-8f9f-290ed08d...

 

Label is being created with the "curly brackets" and the MERGEBARCODE command still visible in the data field.

 

Instructions indicate that Ctrl+F9 must be used, and that typing the curly brackets will not work. 

 

Is there a way to "toggle" the MS Word field codes in LabVIEW? 

 

So far I have not found a way to do this.    

---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 1 of 7
(1,665 Views)

Interesting.  My generation called {} "braces".  Of course, we called # "pound sign" and we didn't even have a term for @.  😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 2 of 7
(1,613 Views)

I don't have a way to do it directly, but I've had problems where the RGT would be a big pain, but a Word/Excel macro would be super simple.

 

In those instances, I just load the data into Word/Excel from LabVIEW, then call a macro from within LabVIEW. It's not as flexible of course, but it's a massive pain to do much advanced plotting or formatting from the RGT. Maybe you can trigger a macro to do it if you can't find a LabVIEW-native way.

Message 3 of 7
(1,610 Views)

I think I may have found a way to do it.  

 

Unfortunately I don't have the required version of MS Word installed on this PC.  Waiting to hear the results of testing. 

 

RGT_ToggleShowCodes.png

 

Here's the MS documentation for MergeBarcode:  

 

https://support.microsoft.com/en-us/office/field-codes-mergebarcode-812fc43f-cb53-4782-8f9f-290ed08d...

 

I concatenated the brackets, command, and switches with my data.  But the "field code" ended up in the field, not the barcode.  

 

Found a post here:  

https://forums.ni.com/t5/LabVIEW/How-to-update-fields-in-word/td-p/3207348

 

And then I found more MS documentation here: 

https://docs.microsoft.com/en-us/office/vba/api/word.fields.toggleshowcodes

 

 

 

---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 4 of 7
(1,593 Views)
Solution
Accepted by pallen

The MergeBarcode method doesn't work and is poorly documented. Use the DisplayBarcode method instead. Here is an example using DisplayBarcode (Field type 99, MergeBarcode is 98).

 

Word AddCreate QR Code.png

 

Ben64

Message 5 of 7
(1,523 Views)

Hi Ben, 

 

Thanks for your reply.  

 

Yesterday the client scripted a macro in the Word template file, and we are having LabVIEW call that macro to show the Field Codes. 

 

Private Sub Show_QRCode()

    ActiveDocument.ActiveWindow.View.ShowFieldCodes = False

End Sub

 

If that does not work, I'll have something else to try now.  Thanks!

 

---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 6 of 7
(1,513 Views)

Thanks Ben, 

 

I ended up using DisplayBarcode (https://support.microsoft.com/en-us/office/field-codes-displaybarcode-6d81eade-762d-4b44-ae81-f9d3d9...

 

Concatenated the command and switches with my data and popped it into a Bookmark on the report template.  Then I call the macro in the template to toggle the field code.  

 

RGT_DisplayBarcode_to_Bookmark.png

---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 7 of 7
(1,487 Views)