Visual Basic (VB) Scripting


How do you turn on document level VB Script events?

Question  Sometimes you need to have a script run only when you save or open or even print a document. These are document level scripted events. They aren't available by default, so how do you turn them on? Answer With the label file you want to script open, go to File > BarTender Document set...

How do you reference the value of a Data Entry Form object in VB Script?

Question  How do you reference the value of a Data Entry Form object in VB Script? Answer  The value of a Data Entry Form object cannot be referenced directly like you would with an object value, but you can reference the template object it's linked to. Here's how to do this: 1. Create an off-lab...

How do you set a dynamic print quantity using a database field and a data entry form value?

Question Each record has a quantity, but I want to set an additional copies per each record in a data entry form. How do you set a dynamic print quantity using a database field and a data entry form value? Answer This can be done with some scripting, as there is no direct means to do this. 1. Cre...

How to conditionally print an object on the last label

Question How to conditionally print an object on the last page, based on an 1 of X serial number. Answer Find below a really simple example which demonstrates how you can do this in BarTender.BarTender documentBasically I've created a new Data Source called "PrintCondition" which uses t...

Mark records being printed from Excel database

Question BarTender is capable of only reading from a database, but I'd like to mark a row as read in Excel once it's done. Is this possible? Answer The best way to go about doing this is to create an additional field in the Excel worksheet to act as a "Label printed" flag. When a record...

How to mark allergens in Uppercase with VBScript

Question  Is it possible to mark up the allergens using uppercase? Answer Yes. As uppercase it is not a "predefined" format in our sample EU FIC Allergen Label, we need first to include additional tags that will help us use the desired format, in this case uppercase. To do that, open th...