Overview of Scripting Objects, Properties, and Methods

Overview of BarTender Scripting Objects, Properties, Functions, and Constants

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

In addition to the many objects, properties, operators, functions, and constants that are built into Visual Basic Script, BarTender's Script Assistant makes some special BarTender-related objects, properties, functions, and constants available.

For more information, click the links below.

Application Object

Email Object

Format Object

Object Object

PageSetup Object

Orientation Constants

Shape Constants

Measurement Units Constants

Encoding Constants

Object Type Constants

Forcing Reference Functions

Database Fields

Shared Substrings

IFF Operator


Application Object

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

The Application object represents the BarTender application that is hosting the VBS script. You refer to it only when you need to refer to one of its properties. Since the BarTender process already exists, you never create an Application object.

Properties

The following properties are supported, and all are Read Only.

Property | Description
BuildNumber | Returns BarTender's build number.
Version | Returns BarTender's version number.


BuildNumber Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the build number of the BarTender application that is hosting the VBScript.

Access

Read Only

Syntax

Application.BuildNumber

The BuildNumber property has the following parts:

Part | Description
Application | Required. A constant referring to the BarTender application that is hosting the VBScript.
BuildNumber | Required. A constant referring to the build number property of the application.

Remarks

This property is intended to be used primarily in the test condition of If…Then…Else statements or Select Case statements. For example,

If Application.Version > 7.0 And Application.BuildNumber > 1540 Then

'other statements here

Else

'alternative statements here

Applies To

Application Object


Version Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the version of the BarTender application that is hosting the VBScript.

Access

Read Only

Syntax

Application.Version

The Version property has the following parts:

Part | Description
Application | Required. A constant referring to the BarTender application that is hosting the VBScript.
Version | Required. A constant referring to the version property of the application.

Remarks

The property is intended to be used primarily in the test condition of If…Then…Else statements or Select Case statements. For example,

If Application.Version > 7.0 And Application.BuildNumber > 1540 Then

'other statements here

Else

'alternative statements here

Applies To

Application Object


Email Object

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

The Email object represents an e-mail message.

Properties

The following properties are supported, and all are Read/Write. These properties can also be set by using the Email.Load function (see below) to load a configuration file.

Property | Description
Authenticate | Sets/returns whether or not the mail server requires a login before an e-mail message can be sent.
BCC | Sets/returns the hidden recipient(s) of the message.
CC | Sets/returns the secondary recipient(s) of the message.
EncodingType | Sets/returns the encoding type of the message.
From | Sets/returns the sender of the message..
LoginName | Sets/returns the login name to be used with the mail server.
MailServer | Sets/returns the name of the mail server.
Message | Sets/returns the content of the body of the message.
Password | Sets/returns the password to be used when logging into the mail server.
Port | Sets/returns the port to be used for communicating with the mail server.
Subject | Sets/returns the subject line of the message.
Timeout | Sets/returns how long, in seconds, BarTender should try to contact the mail server before giving up.
To | Sets/returns the primary recipient(s) of the message..

Functions

The following functions are available:

Method | Description
Load | Loads a configuration file that sets some or all of the Email object's properties.
Send | Sends the message.
Reset | Resets all the Email object's properties to null.


Using the Email Object

The Email Object can be used to send an e-mail message to a designated recipient every time you execute a print job with a label format. Its properties include things like the To property for the recipient's e-mail address, and the Message property containing the message contents. The object has several other properties needed to login with an e-mail server.

Note: Any text object with a VBScript as its data source can be configured to not print. This can be particularly useful if the only purpose of the object is to ensure that an email message is sent with each print job.

You can use this object, for example, to send a "Your order has been shipped" e-mail message to a customer. Simply create a text object (configured to not print, if you like) whose data source will be the customer's e-mail address. Give the object a share/name and use that share/name as the value of the Email.To property in your VBScript with a line like this:

Dim Message
Dim CustomerAddress

Message = "Your order has been shipped"
CustomerAddress = MyCustmerAddressShareName

Email.MailServer = "mail.MyCompany.com"
Email.From = "smith@MyCompany.com"
Email.To = CustomerAddress
Email.Message = Message
Email.Send

Or, the message can be used for internal business purposes. For example, the message might include things like the name of the label format, or selected data from the labels printed, it might report the total number of labels printed. This could be used, for example, to enable a recipient to keep a cumulative total of labels printed from any given label stock. The recipient, perhaps the purchasing department at your company or even your label stock supply company, would then know when you need re-supply of the label stock. Here is an example:

Dim PrinterName
Dim StockType
Dim Message

PrinterName = Format.Printer
StockType = Format.PageSetup.StockType
Message = "Stock " & StockType & " is low in " & PrinterName

Email.MailServer = "mail.MyCompany.com"
Email.From = "smith@MyCompany.com"
Email.To = "jones@MyCompany.com"
Email.Subject = "Stock is running low"
Email.Message = Message
Email.Send

To make extensive use of the Email Object, you can take advantage of the object's Load Function to keep all the parameters, including the message contents, recipient(s), etc. in an Email.ini file. See the Load Function topic for instructions and examples.

If you plan to use the Email Object with many label formats, save the object with the VBScript data source as a component in the Component's Pane of the Toolbox.


Load Function

Description

Sets the values for one or more or the Email object's properties by loading a specified section of a configuration file.

Syntax

Email.Load "Path and Filename", "SectionTitle"

The Load function has the following parts:

Part | Description
Email | Required. A constant referring to the current e-mail message.
Path and Filename | Required. The full path and filename of the configuration file.
SectionTitle | Required. The title of the section of the file.

Remarks

The Email.Load function requires a configuration file that conforms to the standard format of a Windows *.ini (initialization) file. The file must have one or more sections that begin with a title in square brackets. Within each section, one or more of the Email object's properties are listed with a "=" symbol followed by a value.

Note: If the Email.MailServer and Email.To values are not set in the file, then they must be explicitly set in the script.

Below is an example of the contents of such a file. The [StockLow] section sets up the unchanging parts of a message alerting a shipping clerk that a printer is close to running out of blank labels. This section does not specify a Message value because the script will construct the message at print-time based on the Format.Printer and Format.PageSetup.StockType properties. The [Notification] section alerts the purchasing department and the company controller of the need for more stock. Note that the To value includes two addresses separated by a semi-colon.

[StockLow]
MailServer=mail.MyCompany.com
Port=25
Timeout=60
Authenticate=True
LoginName=labelapplication@MyCompany.com
Password=MySecret
From=LabelRobot@MyCompany.com
To=ShippingAttendant@MyCompany.com
Subject="Stock is running low"
EncodingType=btUnicode

[Notification]
MailServer=mail.MyCompany.com
Port=25
Timeout=60
Authenticate=True
LoginName=labelapplication@MyCompany.com
Password=MySecret
From=LabelRobot@MyCompany.com
To="PurchasingDept@MyCompany.com;
 Controller@MyCompany.com"
Subject="More stock needed"
Message="Check label stock supplies and order as needed."
EncodingType=btUTF8

The following example shows the function in use:

Dim PrinterName
Dim StockType
Dim Message

PrinterName = Format.Printer
StockType = Format.PageSetup.StockType
Message = "Stock " & StockType & " is low in " & PrinterName

Email.Load "\\MyServer\Configs\LabelMail.ini", "StockLow"
Email.Message = Message
Email.Send

Email.Load "\\MyServer\Configs\LabelMail.ini", "Notification"
Email.Send

A script can change a property after it has been loaded from a file as in this example:

Dim StockType
Dim Message

StockType = Format.PageSetup.StockType

Email.Load "\\MyServer\Configs\LabelMail.ini", "Notification"

'Change contents of message loaded from the file
Message = "Order more " & StockType
Email.Message = Message
Email.Send

Applies To

Email Object


Reset Function

Description

Resets all of the Email object's properties to null.

Syntax

Enail.Reset

The Reset function has the following parts:

Part | Description
Email | Required. A constant referring to the current e-mail message.

Remarks

This function provides a way to avoid having to explicitly reset several Email object properties to null when you want to send a second message in the same script. The following example shows the function in use:

Dim PrinterName
Dim StockType
Dim Message

PrinterName = Format.Printer
StockType = Format.PageSetup.StockType
Message = "Stock " & StockType & " is low in " & PrinterName

Email.MailServer
 = "ShippingMail.MyCompany.com"
Email.Port = 9956
Email.Authenticate = True
Email.LoginName = "smith@MyCompany.com"
Email.Password = "MyPassword"
Email.From = "smith@MyCompany.com"
Email.To = "jones@MyCompany.com"
Email.CC = "johnson@MyCompany.com"
Email.BCC = "supervisor@MyCompany.com"
Email.Subject = "Stock is running low"
Email.Message = Message
Email.Send

'Prepare and send second message
Email.Reset
Email.MailServer = "CorporateMail.MyCompany.com"
Email.Port = 56101
Email.To = "Purchasing@MyCompany.com"
Email.Subject = "Stock is running low"
Message = "Order two reams of " & StockType
Email.Message = Message
Email.Send

Applies To

Email Object


Send Function

Description

Sends the current e-mail message.

Syntax

Enail.Send

The Send function has the following parts:

Part | Description
Email | Required. A constant referring to the current e-mail message.

Remarks

The Send function will not work unless the Email.MailServer and Email.To properties are set either explicitly or by loading a configuration file with the Email.Load function.

The following example shows the function in use:

Dim PrinterName
Dim StockType
Dim Message

PrinterName = Format.Printer
StockType = Format.PageSetup.StockType
Message = "Stock " & StockType & " is low in " & PrinterName

Email.MailServer = "mail.MyCompany.com"
Email.From = "smith@MyCompany.com"
Email.To = "jones@MyCompany.com"
Email.Subject = "Stock is running low"
Email.Message = Message
Email.Send

Applies To

Email Object


Authenticate Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Sets/returns whether or not the mail server requires users to login before sending an e-mail message.

Access

Read/Write

Syntax

Email.Authenticate [={True|False}]

The Authenticate property has the following parts:

Part | Description
Email | Required. A constant referring to the current e-mail message.
{True|False} | Optional. True means the mail server requires users to login before sending an e-mail message.

Remarks

If this property is set to True, then you must also use the Email.LoginName and Email.Password properties, or else use the Email.Load function to load a configuration file that specifies the user's name and password. Here is an example of the property in use:

Dim PrinterName
Dim StockType
Dim Message

PrinterName = Format.Printer
StockType = Format.PageSetup.StockType
Message = "Stock " & StockType & " is low in " & PrinterName

Email.MailServer
 = "mail.MyCompany.com"
Email.Authenticate = True
Email.LoginName = "smith@MyCompany.com"
Email.Password = "MyPassword"
Email.To = "jones@MyCompany.com"
Email.Subject = "Stock is running low"
Email.Message = Message
Email.Send

Applies To

Email Object


BCC Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Sets/returns the e-mail address of the hidden message recipients.

Access

Read/Write

Syntax

Email.BCC [="e-mail address(es)"]

The BCC property has the following parts:

Part | Description
Email | Required. A constant referring to the current e-mail message.
e-mail address(es) | Optional. The e-mail address(es), separated with semi-colons.

Remarks

The recipients listed on the BCC line of an e-mail message are hidden in the sense that no other recipient is aware that the individuals on the BCC line got a copy of the message. Here is an example of the property in use:

Dim PrinterName
Dim StockType
Dim Message

PrinterName = Format.Printer
StockType = Format.PageSetup.StockType
Message = "Stock " & StockType & " is low in " & PrinterName

Email.MailServer
 = "mail.MyCompany.com"
Email.From = "smith@MyCompany.com"
Email.To = "jones@MyCompany.com"
Email.BCC = "johnson@MyCompany.com;supervisor@MyCompany.com"
Email.Subject = "Stock is running low"
Email.Message = Message
Email.Send

Applies To

Email Object


CC Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Sets/returns the e-mail address of the additional message recipients.

Access

Read/Write

Syntax

Email.CC [="e-mail address(es)"]

The CC property has the following parts:

Part | Description
Email | Required. A constant referring to the current e-mail message.
e-mail address(es) | Optional. The e-mail address(es), separated with semi-colons.

Remarks

Here is an example of the property in use:

Dim PrinterName
Dim StockType
Dim Message

PrinterName = Format.Printer
StockType = Format.PageSetup.StockType
Message = "Stock " & StockType & " is low in " & PrinterName

Email.MailServer
 = "mail.MyCompany.com"
Email.From = "smith@MyCompany.com"
Email.To = "jones@MyCompany.com"
Email.CC = "johnson@MyCompany.com;supervisor@MyCompany.com"
Email.Subject = "Stock is running low"
Email.Message = Message
Email.Send

Applies To

Email Object


EncodingType Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Sets and returns the encoding of the Email object, one of the BtEncodingType values.

Access

Read/Write

Syntax

Email.EncodingType [={BtEncodingType}]

The EncodingType property has the following parts:

Part | Description
Email | Required. A constant referring to the current e-mail object.
BtEncodingType | Optional. One of the BtEncodingType constants.

Remarks

Sets or returns (as a Long data type) one of the BtEncodingType constants. Here is an example of the property in use:

Dim PrinterName
Dim StockType
Dim Message

PrinterName = Format.Printer
StockType = Format.PageSetup.StockType
Message = "Stock " & StockType & " is low in " & PrinterName

Email.MailServer
 = "mail.MyCompany.com"
Email.Authenticate = True
Email.LoginName = "smith@MyCompany.com"
Email.Password = "MyPassword"
Email.To = "jones@MyCompany.com"
Email.Subject = "Stock is running low"
Email.Message = Message
Email.EncodingType = btUnicode
Email.Send

Applies To

Email Object


From Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Sets/returns the e-mail address of the message sender.

Access

Read/Write

Syntax

Email.From [="e-mail address"]

The From property has the following parts:

Part | Description
Email | Required. A constant referring to the current e-mail message.
e-mail address | Optional. The e-mail address.

Remarks

Here is an example of the property in use:

Dim PrinterName
Dim StockType
Dim Message

PrinterName = Format.Printer
StockType = Format.PageSetup.StockType
Message = "Stock " & StockType & " is low in " & PrinterName

Email.MailServer = "mail.MyCompany.com"
Email.From = "smith@MyCompany.com"
Email.To = "jones@MyCompany.com"
Email.Subject = "Stock is running low"
Email.Message = Message
Email.Send

Applies To

Email Object


LoginName Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Sets/returns the name to use when logging in to the mail server.

Access

Read/Write

Syntax

Email.LoginName [="Name"]

The LoginName property has the following parts:

Part | Description
Email | Required. A constant referring to the current e-mail message.
Name | Optional. The name to use when logging in to the mail server.

Remarks

Here is an example of the property in use:

Dim PrinterName
Dim StockType
Dim Message

PrinterName = Format.Printer
StockType = Format.PageSetup.StockType
Message = "Stock " & StockType & " is low in " & PrinterName

Email.MailServer
 = "mail.MyCompany.com"
Email.Authenticate = True
Email.LoginName = "smith@MyCompany.com"
Email.Password = "MyPassword"
Email.To = "jones@MyCompany.com"
Email.Subject = "Stock is running low"
Email.Message = Message
Email.Send

Applies To

Email Object


MailServer Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Sets/returns the name of the mail server as either a UNC name (e.g.., myserver.mycompany.com) or an IP address (e.g., 255.144.77.18).

Access

Read/Write

Syntax

Email.MailServer [="Mail Server"]

The MailServer property has the following parts:

Part | Description
Email | Required. A constant referring to the current e-mail message.
Mail Server | Optional. The mail server's UNC name or IP address.

Remarks

The script must write to this property unless the Email.Load function is being used with a configuration file that specifies the mail server. Here is an example of the property in use:

Dim PrinterName
Dim StockType
Dim Message

PrinterName = Format.Printer
StockType = Format.PageSetup.StockType
Message = "Stock " & StockType & " is low in " & PrinterName

Email.MailServer = "mail.MyCompany.com"
Email.To = "jones@MyCompany.com"
Email.Subject = "Stock is running low"
Email.Message = Message
Email.Send

Applies To

Email Object


Message Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Sets/returns the content of the body of the e-mail message.

Access

Read/Write

Syntax

Email.Message [="message"]

The Subject property has the following parts:

Part | Description
Email | Required. A constant referring to the current e-mail message.
message | Optional. The content of the body of the e-mail message.

Remarks

Here is an example of the property in use:

Dim PrinterName
Dim StockType
Dim Message

PrinterName = Format.Printer
StockType = Format.PageSetup.StockType
Message = "Stock " & StockType & " is low in " & PrinterName

Email.MailServer = "mail.MyCompany.com"
Email.From = "smith@MyCompany.com"
Email.To = "jones@MyCompany.com"
Email.Subject = "Stock is running low"
Email.Message = Message
Email.Send

Applies To

Email Object


Password Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Sets/returns the password to use when logging in to the mail server.

Access

Read/Write

Syntax

Email.Password [="password"]

The Password property has the following parts:

Part | Description
Email | Required. A constant referring to the current e-mail message.
password | Optional. The password to use when logging in to the mail server.

Remarks

Here is an example of the property in use:

Dim PrinterName
Dim StockType
Dim Message

PrinterName = Format.Printer
StockType = Format.PageSetup.StockType
Message = "Stock " & StockType & " is low in " & PrinterName

Email.MailServer
 = "mail.MyCompany.com"
Email.Authenticate = True
Email.LoginName = "smith@MyCompany.com"
Email.Password = "MyPassword"
Email.To = "jones@MyCompany.com"
Email.Subject = "Stock is running low"
Email.Message = Message
Email.Send

Applies To

Email Object


Port Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Sets/returns the port to be used for communicating with the mail server.

Access

Read/Write

Syntax

Email.Port [=Port]

The Port property has the following parts:

Part | Description
Email | Required. A constant referring to the current e-mail message.
Port | Optional. The port number, an integer.

Remarks

Here is an example of the property in use:

Dim PrinterName
Dim StockType
Dim Message

PrinterName = Format.Printer
StockType = Format.PageSetup.StockType
Message = "Stock " & StockType & " is low in " & PrinterName

Email.MailServer = "mail.MyCompany.com"
Email.Port = 9956
Email.To = "jones@MyCompany.com"
Email.Subject = "Stock is running low"
Email.Message = Message
Email.Send

Applies To

Email Object


Subject Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Sets/returns the subject line of the e-mail message.

Access

Read/Write

Syntax

Email.Subject [="subject line"]

The Subject property has the following parts:

Part | Description
Email | Required. A constant referring to the current e-mail message.
subject line | Optional. The content of the subject line for the e-mail message.

Remarks

Here is an example of the property in use:

Dim PrinterName
Dim StockType
Dim Message

PrinterName = Format.Printer
StockType = Format.PageSetup.StockType
Message = "Stock " & StockType & " is low in " & PrinterName

Email.MailServer = "mail.MyCompany.com"
Email.From = "smith@MyCompany.com"
Email.To = "jones@MyCompany.com"
Email.Subject = "Stock is running low"
Email.Message = Message
Email.Send

Applies To

Email Object


Timeout Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Sets/returns how long, in seconds, BarTender should keep trying to reach the mail server before giving up.

Access

Read/Write

Syntax

Email.Timeout [=Timeout]

The Timeout property has the following parts:

Part | Description
Email | Required. A constant referring to the current e-mail message.
Timeout | Optional. The number of seconds.

Remarks

Here is an example of the property in use:

Dim PrinterName
Dim StockType
Dim Message

PrinterName = Format.Printer
StockType = Format.PageSetup.StockType
Message = "Stock " & StockType & " is low in " & PrinterName

Email.MailServer = "mail.MyCompany.com"
Email.Timeout = 10
Email.To = "jones@MyCompany.com"
Email.Subject = "Stock is running low"
Email.Message = Message
Email.Send

Applies To

Email Object


To Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Sets/returns the e-mail address(es) of the message recipient(s).

Access

Read/Write

Syntax

Email.To [="e-mail address(es)"]

The To property has the following parts:

Part | Description
Email | Required. A constant referring to the current e-mail message.
e-mail address(es) | Optional. The e-mail address(es), separated with semi-colons.

Remarks

This property must be set by the script unless the Email.Load function is being used to load a configuration file that sets the recipient(s). Here is an example of the property in use:

Dim PrinterName
Dim StockType
Dim Message

PrinterName = Format.Printer
StockType = Format.PageSetup.StockType
Message = "Stock " & StockType & " is low in " & PrinterName

Email.MailServer = "mail.MyCompany.com"
Email.From = "smith@MyCompany.com"
Email.To = "jones@MyCompany.com"
Email.Subject = "Stock is running low"
Email.Message = Message
Email.Send

Applies To

Email Object


Format Object

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

The Format object represents a label format.

Properties

The following properties are supported, and all are Read Only.

Property | Description
BaseName | Returns the file name without the *.btw extension.
DbSupportFieldnames | Returns True if the currently opened database supports field names.
Directory | Returns the directory of the label format file.
FileName | Returns the format's file name, including the *.btw extension.
IdenticalCopiesOfLabel | Returns the number of identical copies of the label in the print job.
IsNewRecord | Returns True when the print job opens a new record.
IsPrinting | Returns True when the print job is in progress.
IsPrintPreview | Returns True when BarTender is preparing a Print Preview of the current label format.
IsPrompting | Returns True when a prompt is open.
NumberSerializedLabels | Returns the number of serialized labels in the print job.
Object | Returns a reference to an object on the label format.
Objects Collection | Returns a reference to the Objects collection.
PageSetup | Returns a reference to the PageSetup object.
Printer | Returns the name of the printer.
Title | Returns the title of the label format.

Functions

The following functions are available:

Method | Description
CancelPrinting | Prompts user with option to cancel or continue current print job.
FlushLog | Forces accumulated information about the print job to be written to the log immediately.
WriteToLog | Writes a custom entry to the log file.

Method | Description
CancelPrinting | Prompts user with option to cancel or continue current print job.


CancelPrinting Function

Description

Puts a prompt on the screen giving the user a chance to cancel the print job, or informing the user that the print job is being canceled.

Syntax

Format.CancelPrinting(Message, ContinueButtonLabel)

The CancelPrinting function has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
Message | Required. Text of the prompt.
ContinueButtonLabel | Optional. Label on the button that gives the user an opportunity to continue with the print job rather than cancel it. Default is "Continue".

Remarks

The CancelPrinting function puts a prompt on the screen giving the user a chance to cancel the print job, or informing the user that the print job is being canceled. If ContinueLabelButton is null (""), then the user cannot prevent the cancellation of the print job and the message has only an OK button. If ContinueLabelButton is left out entirely, the message has a Cancel button (which accepts cancellation of the print job) and a Continue button (which overrides cancellation of the print job. If ContinueLabelButton is present and not null, it specifies the label of the second button.

The following example checks the number of serialized labels. If it is greater than 1000, a prompt appears telling the user there are too many labels. The prompt has a single OK button. If the number is between 500 and 1000, a prompt gives the user the option of canceling the print job or letting it continue. The prompt will have a Cancel and a Print Anyway button.

If Format.NumberSerializedLabels > 1000 Then

Call Format.CancelPrinting("Too Many Labels. Job is being canceled.", "")

ElseIf Format.NumberSerializedLabels > 500 AND Format.NumberSerializedLabels < 1000 Then

Call Format.CancelPrinting("500-1000 Labels. Do you want to cancel?", "Print Anyway")

End If

Applies To

Format


FlushLog Function

Description

Forces all information that has accumulated for the print job to be written to the log immediately without waiting for the print job to end.

Syntax

Format.FlushLog

The FlushLog function has the following parts:

Part | Description
Format | Required. A constant referring to the current format.

Remarks

The FlushLog function can be used to force an update of the log file before a print job is complete. This can be useful when print jobs are frequently cancelled before completion. In this example, used as an event control script assigned to the OnIdenticalCopies event, users are prompted to enter a package weight for each (otherwise identical) label. When the last package has been processed, they enter "x" to the prompt. The log is then written and the print job is cancelled.

weight = InputBox("Press Button on Scale to enter Weight","Box Weight")

IF LCase(weight) = "x" THEN

Format.FlushLog

Format.CancelPrinting("Remainder of Print Job is being cancelled")

END IF

Applies To

Format


WriteToLog Function

Description

Writes a custom string to the BarTender log file.

Syntax

Format.WriteToLog(LogMessage)

The CancelPrinting function has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
LogMessage | Required. String. Text of the log entry.

Remarks

The WriteToLog function enables you to add customized entries to the BarTender log file.

The following example checks the number of serialized labels. If it is greater than 1000, a prompt appears telling the user there are too many labels. It then adds a log entry about the incident.

If Format.NumberSerializedLabels > 1000 Then

Format.CancelPrinting("Too Many Labels. Job is being canceled.", "")

Format.WriteToLog("Print Job Canceled for" & Format.Filename)

End If

Applies To

Format Object


BaseName Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the name of the current format file without the BTW extension.

Access

Read Only

Syntax

Format.BaseName

The BaseName property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.

Remarks

Returns the base name of the current format file without the BTW extension.

Applies To

Format Object

SEE ALSO:

FileName Property


DbSupportsFieldNames Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns True if the currently opened database supports field names, returns False otherwise.

Access

Read Only

Syntax

Format.DbSupportsFieldNames

The DbSupportsFieldNames property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.

Remarks

Returns True if the currently opened database supports field names, returns False otherwise.

Applies To

Format Object


Directory Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the directory of the label format file.

Access

Read Only

Syntax

Format.Directory

The Directory property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.

Remarks

The Directory returns the directory of the label format. It does not include the label format file name.

Applies To

Format Object


FileName Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the label format's file name including the *.btw extension.

Access

Read only.

Syntax

Format.FileName

The FileName property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.

Remarks

The FileName property returns the format's file name including the *.btw extension.

The following example shows how to use the FileName property.

Dim formatName

formatName = Format.FileName

Applies To

Format Object

SEE ALSO:

BaseName Property


IdenticalCopiesOfLabel Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the number of identical copies of the label.

Access

Read Only

Syntax

Format.IdenticalCopiesOfLabel

The IdenticalCopiesOfLabel property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.

Remarks

The IdenticalCopiesOfLabel returns the number of copies that will print of each label or, when serializing labels, of each label in a sequence.

Applies To

Formats


IsNewRecord Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns True if the print job has opened a new record from the database, returns False otherwise.

Access

Read Only

Syntax

Format.IsNewRecord

The IsNewRecord property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.

Remarks

Returns True if the print job has opened a new record from the database, returns False otherwise.

Applies To

Format Object


IsPrinting Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns True if a print job is in progress, returns False otherwise.

Access

Read Only

Syntax

Format.IsPrinting

The IsPrinting property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.

Remarks

Returns True if the label is being printed, returns False otherwise.

Applies To

Format Object


IsPrintPreview Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns True if BarTender is preparing a Print Preview of the current label format, returns False otherwise.

Access

Read Only

Syntax

Format.IsPrintPreview

The IsPrintPreview property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.

Remarks

Returns True if BarTender is preparing a Print Preview of the current label format, returns False otherwise.

Applies To

Format Object


IsPrompting Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns True if the prompt dialog is open, returns False otherwise.

Access

Read Only

Syntax

Format.IsPrompting

The IsPrompting property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.

Remarks

Returns True if the prompt dialog is open, returns False otherwise.

Applies To

Format Object


NumberSerializedLabels Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the number of serialized labels that will print in the current print job.

Access

Read Only.

Syntax

Format.NumberSerializedLabels

The NumberSerializedLabels property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.

Remarks

Returns the number of serialized labels that will print in the current print job.

The following example shows how to use the FileName property.

Dim TotalPrinted

TotalPrinted = Format.NumberOfSerializedLabels

MsgBox(Format.Filename & " " & TotalPrinted)

Applies To

Format Object


Object Object

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

The Object object represents an object on a format, e.g., a bar code or text object. It is a member of the format's Object Collection.

Properties

The following properties are supported, and all are Read-only.

Property | Description
Name | Returns the object's name. (This is not the same as the share name of a substring. Even if a text or bar code object has only one substring, it's object name is different from that substring's share name, if any.)
Type | Returns the object's type as one of the BtObject constants.
Value | Returns the current value of the object.
EncodedValue | Returns the hexadecimal value that will be encoded into an RFID transponder. This property exists only if the Type is btObjectRFID.

Property | Description
Name | Returns the object's name. (This is not the same as the share name of a substring. Even if a text or bar code object has only one substring, it's object name is different from that substring's share name, if any.)
Type | Returns the object's type as one of the BtObject constants.
Value | Returns the current value of the object.


Objects Collection

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

The Objects collection manages the set of objects (e.g., bar codes and text objects) on the current format.

Properties

The following properties are supported:

Property | Description
Count | Returns the number of objects.

Methods

The following methods are supported:

Method | Description
Item | Returns a reference to a specified object identified by index number or by name.


PageSetup Object

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Used to access the page setup characteristics of the Format object.

Properties

The following properties are supported:

Property | Description
LabelColumns | Returns the number of columns on each page.
LabelCorners | Returns whether the label corners are rounded or sharp.
LabelHeight | Returns the height of each label.
LabelHole | Returns whether or not there is a hole in the label.
LableHoleDiameter | Returns the diameter of the hole in the label.
LabelRows | Returns the number of rows on each page.
LabelShape | Returns whether label is rectangular or elliptical.
LabelSizeManual | Returns whether to use manually set label parameters or is accept the defaults of the label stock.
LabelWidth | Returns the width of each label.
MarginBottom | Returns the bottom margin of the page.
MarginLeft | Returns the left-side margin of the page.
MarginRight | Returns the right-side margin of the page.
MarginTop | Returns the top margin of the page.
Orientation | Returns the page's orientation (portrait or landscape).
PaperID | Returns the printer's ID number of the paper size.
PaperHeight | Returns the paper height.
PaperName | Returns the paper size, such as "A4" or "letter".
PaperWidth | Returns the paper width.
StockCategory | Returns the name of the stock category, usually a label stock manufacturer.
StockType | Returns the name of the stock type, usually the label stock manufacturer's "model" name of the label stock.
Valid | Returns the True when there are no inconsistencies in the page setup properties.


Printer Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the name of the printer.

Access

Read Only.

Syntax

Format.Printer

The Printer property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.

Remarks

The Printer property returns the name of the printer to which the label is currently assigned.

The following example shows how to use the Printer property.

Dim PrinterName

PrinterName = Format.Printer

Applies To

Format Object


Title Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the title of the label format.

Access

Read Only

Syntax

Format.Title

The Title property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.

Remarks

The Title returns the format portion of the title bar for the label format. Not necessarily the same as the format file name because if the format has not yet been saved, no format file name will exist.

The following example shows how to use the FileName property.

Dim FormatTitle

FormatTitle = Format.Title

Applies To

Format Object


EncodedValue Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns, as a hexadecimal number, the value of an RFID object that will be encoded into the RFID transponder.

Access

Read Only

Syntax

Format.Objects.Item(index or "name").EncodedValue

The EncodedValue property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
Objects | Required. A constant referring to the Objects collection of the current format.
Item | Optional. A constant referring to the Item method.
index or "name" | Required. The index number (or the name in quotation marks) of the object.
EncodedValue | Required. A constant referring to the EncodedValue property of the object.

Remarks

This property only exists for RFID objects.

Applies To

Object Object


Name Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the name of an object (e.g., a bar code or text object) on a label format.

Access

Read Only

Syntax

Format.Objects.Item(index or "name").Name

The Name property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
Objects | Required. A constant referring to the Objects collection of the current format.
Item | Optional. A constant referring to the Item method.
index or "name" | Required. The index number (or the name in quotation marks) of the object.
Name | Required. A constant referring to the name property of the object.

Remarks

The name of an object is not the same thing as the share name of a substring. Even if a text or bar code object has only one substring, it's object name is different from its substring's share name, if any.

Applies To

Object Object


Type Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the type of an object (e.g., a bar code or text object) on a label format.

Access

Read Only

Syntax

Format.Objects.Item(index or "name").Type

The Type property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
Objects | Required. A constant referring to the Objects collection of the current format.
Item | Optional. A constant referring to the Item method.
index or "name" | Required. The index number (or the name in quotation marks) of the object.
Type | Required. A constant referring to the type of the object.

Remarks

Returns one of the BtObject constants.

Applies To

Object Object


Value Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the value of an object (e.g., a bar code or text object) on a label format.

Access

Read Only

Syntax

Format.Objects.Item(index or "name").Value

The Value property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
Objects | Required. A constant referring to the Objects collection of the current format.
Item | Optional. A constant referring to the Item method.
index or "name" | Required. The index number (or the name in quotation marks) of the object.
Value | Required. A constant referring to the value of the object.

Remarks

Bar codes and text objects will return their current value. The Value of a box or line object is always a blank string. For a picture object the Value will depend on how it is attached to the label:

  • Embedded. The full path and filename of the image file at the time it was embedded.

  • Linked. The full path and filename of the image file.

  • Data Sourced. The concatenation of the default path and the contents of the data source. At print-time, this will resolve into the full path and filename of the image file.

Applies To

Object Object


Item Function (Objects)

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns a reference to a specified Object object.

Syntax

object.Item(index or "name")

The Item function has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Item | Optional. A constant referring to the Item function.
index or "name" | Required. Index of the Object object to reference. Can be either an integer or the object's name in quotation marks.

Remarks

Use the Item function to access a specific Object object on a label format. Item is the default method for the Objects collection, therefore the Item function does not have to be specified in order to get a reference to a given Object object: object(index or "name") would also work if object evaluates to an object on the Applies To list.

Applies To

Objects Collection


Count Property (Objects)

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the number of objects (e.g., bar codes and text objects) on a label format.

Access

Read Only

Syntax

object.Count

The Count property has the following parts:

Part | Description
object | Required. An object expression that evaluates to an object in the Applies To list.
Count | Required. A constant referring to the Count property.

Remarks

The Count property returns the number of objects currently the label format.

Applies To

Objects Collection


LabelColumns Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the number of columns of labels on each page of stock.

Access

Read Only

Syntax

Format.PageSetup.LabelColumns

The LabelColumns property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.

Remarks

Returns the number of columns of labels on each page of stock.

Applies To

PageSetup Object


LabelCorners Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns whether or not the label's corners are rounded or sharp.

Access

Read Only

Syntax

Format.PageSetup.LabelCorners

The LabelCorners property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.

Remarks

Returns, as a Long data type, btRound if the corners of the label are rounded. Otherwise, returns btSquare because the corners are sharp. This property is only valid when Format.PageSetup.LabelShape = btRectangle.

Applies To

PageSetup Object


LabelHeight Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the label's height in the units specified.

Access

Read Only

Syntax

Format.PageSetup.LabelHeight(units)

The LabelHeight property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.
units | Optional. The measurement units in which the value should be expressed. Must be one of the BtUnits constants: btUnitsCurrent = 0 [default] btUnitsInches = 1 btUnitsCentimeters = 2 btUnitsMillimeters = 3

Remarks

Returns the height of each label in the units specified.

labelheight = Format.PageSetup.LabelHeight(btUnitsCentimeters)

Applies To

PageSetup Object


LabelHole Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns True when the label format has a hole, otherwise False.

Access

Read Only

Syntax

Format.PageSetup.LabelHole

The LabelHole property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.

Remarks

This property is only valid when LabelShape = btEllipse.

Applies To

PageSetup Object


LabelHoleDiameter Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the diameter of the hole in the label in the units specified.

Access

Read Only

Syntax

Format.PageSetup.LabelHoleDiameter(units)

The LabelHoleDiameter property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.
units | Optional. The measurement units in which the value should be expressed. Must be one of the BtUnits constants: btUnitsCurrent = 0 [default] btUnitsInches = 1 btUnitsCentimeters = 2 btUnitsMillimeters = 3

Remarks

This property is only valid when LabelHole = True and LabelShape = btEllipse. Here is an example of the LabelHoleDiameter property in use:

HoleDiameter = Format.PageSetup.LabelHoleDiameter(btUnitsCurrent)

Applies To

PageSetup Object


LabelRows Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the number of rows of labels on each page of stock.

Access

Read Only

Syntax

Format.PageSetup.LabelRows

The LabelRows property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.

Remarks

Returns the number of rows of labels on each page of stock.

Applies To

PageSetup Object


LabelShape Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the basic label shape, either rectangular or elliptical.

Access

Read Only

Syntax

Format.PageSetup.LabelShape

The LabelShape property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.

Remarks

Always returns either btRectangle or btEllipse as data type Long.

Applies To

PageSetup Object


LabelSizeManual Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns True if label dimensions are being set manually, otherwise False.

Access

Read Only

Syntax

Format.PageSetup.LabelSizeManual

The LabelSizeManual property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.

Remarks

When LabelSizeManual is false, BarTender will size the labels based on the other PageSetup properties.

Applies To

PageSetup Object


LabelWidth Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the width of each label in the units specified.

Access

Read Only

Syntax

Format.PageSetup.LabelWidth(units)

The LabelWidth property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.
units | Optional. The measurement units in which the value should be expressed. Must be one of the BtUnits constants: btUnitsCurrent = 0 [default] btUnitsInches = 1 btUnitsCentimeters = 2 btUnitsMillimeters = 3

Remarks

Returns the width of each label in the units specified. Here is an example of the property's use in Visual Basic:

labelwidth = Format.PageSetup.LabelWidth(btUnitsInches)

Applies To

PageSetup Object


MarginBottom Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the size of the bottom margin of the paper, in the units specified.

Access

Read Only

Syntax

Format.PageSetup.MarginBottom(units)

The MarginBottom property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.
units | Optional. The measurement units in which the value should be expressed. Must be one of the BtUnits constants: btUnitsCurrent = 0 [default] btUnitsInches = 1 btUnitsCentimeters = 2 btUnitsMillimeters = 3

Remarks

Returns the size of the bottom margin of the paper, in the units specified. Here is an example of the property's use in Visual Basic:

bottomMargin = btPageSetup.MarginBottom(btUnitsMillimeters)

Applies To

PageSetup Object


MarginLeft Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the size of the left margin of the paper, in the units specified.

Access

Read Only

Syntax

Format.PageSetup.MarginLeft(units)

The MarginLeft property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.
units | Optional. The measurement units in which the value should be expressed. Must be one of the BtUnits constants: btUnitsCurrent = 0 [default] btUnitsInches = 1 btUnitsCentimeters = 2 btUnitsMillimeters = 3

Remarks

Returns the size of the left margin of the paper, in the units specified. Here is an example of the property's use in Visual Basic:

leftMargin = Format.PageSetup.MarginLeft(btUnitsMillimeters)

Applies To

PageSetup Object


MarginRight Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the size of the right margin of the paper, in the units specified.

Access

Read Only

Syntax

Format.PageSetup.MarginRight(units)

The MarginRight property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.
units | Optional. The measurement units in which the value should be expressed. Must be one of the BtUnits constants: btUnitsCurrent = 0 [default] btUnitsInches = 1 btUnitsCentimeters = 2 btUnitsMillimeters = 3

Remarks

Returns the size of the right margin of the paper, in the units specified. Here is an example of the property's use in Visual Basic:

rightMargin = Format.PageSetup.MarginRight(btUnitsMillimeters)

Applies To

PageSetup Object


MarginTop Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the size of the top margin of the paper, in the units specified.

Access

Read Only

Syntax

Format.PageSetup.MarginTop(units)

The MarginTop property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.
units | Optional. The measurement units in which the value should be expressed. Must be one of the BtUnits constants: btUnitsCurrent = 0 [default] btUnitsInches = 1 btUnitsCentimeters = 2 btUnitsMillimeters = 3

Remarks

Returns the size of the top margin of the paper, in the units specified. Here is an example of the property's use in Visual Basic:

topMargin = Format.PageSetup.MarginTop(btUnitsMillimeters)

Applies To

PageSetup Object


Orientation Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the orientation of the paper, either portrait or landscape.

Access

Read Only

Syntax

Format.PageSetup.Orientation

The Orientation property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.

Remarks

Returns (as a Long data type) one of the BtOrientation constants, either btPortrait or btLandscape.

Applies To

PageSetup Object


PaperHeight Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the height of the paper stock in the units specified.

Access

Read Only

Syntax

Format.PageSetup.PaperHeight(units)

The PaperHeight property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.
units | Optional. The measurement units in which the value should be expressed. Must be one of the BtUnits constants: btUnitsCurrent = 0 [default] btUnitsInches = 1 btUnitsCentimeters = 2 btUnitsMillimeters = 3

Remarks

Returns the height of the paper stock in the units specified.

paperheight = Format.PageSetup.PaperHeight(btUnitsInches)

Applies To

PageSetup Object


PaperID Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the printer's ID number for the paper size. This is the printer driver's internal equivalent of the PaperName. For a list of the possible paper sizes and their corresponding ID numbers, see the file wingdi.h which comes with the Windows SDK.

Access

Read Only

Syntax

Format.PageSetup.PaperID

The PaperID property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.

Remarks

Returns the paper ID. This is the printer driver's internal equivalent of the PaperName.

Applies To

PageSetup Object


PaperName Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the paper size, such as "A4" or "letter". Compare with PaperID.

Access

Read Only

Syntax

Format.PageSetup.PaperName

The PaperName property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.

Remarks

Returns the paper size, such as "A4" or "letter". Compare with PaperID.

Applies To

PageSetup Object


PaperWidth Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the width of the paper stock in the units specified.

Access

Read Only

Syntax

Format.PageSetup.PaperWidth(units)

The PaperWidth property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.
units | Optional. The measurement units in which the value should be expressed. Must be one of the BtUnits constants: btUnitsCurrent = 0 [default] btUnitsInches = 1 btUnitsCentimeters = 2 btUnitsMillimeters = 3

Remarks

Returns the width of the paper stock in the units specified.

paperwidth = Format.PageSetup.PaperWidth(btUnitsInches)

Applies To

PageSetup Object


StockCategory Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the name of the label stock category, typically a manufacturer of label stock.

Access

Read Only

Syntax

Format.PageSetup.StockCategory

The StockCategory property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.

Remarks

Returns the name of the label stock category, typically a manufacturer of label stock.

Applies To

PageSetup Object


StockType Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns the name of the stock type. Typically, this is the stock manufacturer's "model" and size name for the stock.

Access

Read Only

Syntax

Format.PageSetup.StockType

The StockType property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.

Remarks

Returns the name of the stock type. Typically, this is the stock manufacturer's "model" and size name for the stock.

Applies To

PageSetup Object


Valid Property

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

Returns True if there are no inconsistencies in the other PageSetup properties (i.e. a label width larger than the paper width), otherwise returns False.

Access

Read Only

Syntax

Format.PageSetup.Valid

The Valid property has the following parts:

Part | Description
Format | Required. A constant referring to the current format.
PageSetup | Required. A constant referring to the PageSetup of the current format.

Remarks

Returns True if there are no inconsistencies in the other PageSetup properties (i.e. a label width larger than the paper width), otherwise returns False. Here is an example of the property in use:

If Not Format.PageSetup.Valid Then

Format.CancelPrinting("Page setup conflict. Job is being canceled.", "")

End If

Applies To

PageSetup Object


BtEncodingType Constants

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

The EncodingType Property of the Email object always has one of these values. These are type Long constants.

Constant | Value | Description
BtUnicode | 0 | Use Unicode.
BtUTF8 | 1 | Use UTF-8.
BtWindowsSettings | 2 | Use the default Windows encoding.
BtArabic_1256 | 3 | Use the specified encoding.
BtBaltic_1257 | 4 | Use the specified encoding.
BtCentralEurope_1250 | 5 | Use the specified encoding.
BtChineseSimplified_936 | 6 | Use the specified encoding.
BtChineseTraditional_950 | 7 | Use the specified encoding.
BtCyrillic_1251 | 8 | Use the specified encoding.
BtGreek_1253 | 9 | Use the specified encoding.
BtHebrew_1255 | 10 | Use the specified encoding.
BtJapanese_932 | 11 | Use the specified encoding.
BtKorean_949 | 12 | Use the specified encoding.
BtThai_874 | 13 | Use the specified encoding.
BtTurkish_1254 | 14 | Use the specified encoding.
BtANSI_1252 | 15 | Use the specified encoding.
BtVietNam_1258 | 16 | Use the specified encoding.


BtObject Constants

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

The Type property of the Object object always has one of these values. These are type Long constants.

Constant | Value | Description
btObjectBox | 2 | The object is a box.
btObjectLine | 3 | The object is a line.
btObjectBarcode | 4 | The object is a bar code.
btObjectText | 5 | The object is text.
btObjectRFID | 6 | The object is an RFID transponder.
btObjectPicture | 7 | The object is a picture.
btObjectEllipse | 8 | The object is an ellipse.

Constant | Value | Description
btObjectBox | 2 | The object is a box.
btObjectLine | 3 | The object is a line.
btObjectBarcode | 4 | The object is a bar code.
btObjectText | 5 | The object is text.
btObjectPicture | 7 | The object is a picture.


BtOrientation Constants

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

The Orientation Property of the PageSetup object always has one of these values. These are type Long constants.

Constant | Value | Description
BtPortrait | 0 | Page will print with portrait orientation.
BtLandscape | 1 | Page will print with landscape orientation.


BtShape Constants

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

The LabelShape Property of the PageSetup object is always BtRectangle or BtEllipse. The LabelCorners Property of the PageSetup object always is always BtSquare or BtRound. The LabelCorners property is ignored when the LabelShape property is set to BtEllipse. These are type Long constants.

Note: The values begin with "1", not "0".

Constant | Value | Description
BtSquare | 1 | For pointed corners on a rectangular label. (This property is valid for only the LabelCorners property).
BtRectangle | 2 | For rectangular labels. (This property is valid for only the LabelShape property.)
BtRound | 3 | For rounded corners on a rectangular label. (This property is valid for only the LabelCorners property).
BtEllipse | 4 | For round or elliptical labels. (This property is valid for only the LabelShape property.)


BtUnits Constants

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

Description

All of the PageSetup properties that return numerical measurements, such as PaperWidth and MarginLeft, take one of these constants as an argument. These are type Long constants.

Constant | Value | Description
BtUnitsCurrent | 0 | Whatever is the current units-of-measure setting being used by BarTender.
BtUnitsInches | 1 |
BtUnitsCentimeters | 2 |
BtUnitsMillimeters | 3 |


Forcing Reference Functions

The Categories box of the Script Assistant includes Declarations. This category contains two special functions, ReferenceField and ReferenceSharedSubString, that are used to force BarTender to refer to a database field or substring when it does a test of a script. This ensures that BarTender properly decides when to trigger the OnAutoSelectEvent event.

When you have associated a database with the label format, a list of the database fields will appear under ReferenceField in the Name box of the Script Assistant. When you have named at least one substring on the label, a list of all named substrings will appear under ReferenceSharedSubString in the Name box of the Script Assistant. To insert a forced reference to a field or substring into your script, place your cursor in the script above any conditional structures in the script. Highlight the field or substring name in the Name box and click Insert. The appropriate function will be inserted with your chosen field or substring as its argument.


UCCApplicationIdentifier Function

Note: This topic is about internal BarTender Visual Basic Scripting. It is not about ActiveX Automation of BarTender.

The Categories box of the Script Assistant includes Bar Code (under Functions). This category contains the special function UCCApplicationIdentifier that is used to format a text object with the EAN.UCC application identifier(s). It can be used if you want the human readable part of a bar code to appear above the bar code and/or appear on multiple lines.

Description

Returns the data for a text object formatted with EAN.UCC application identifiers.

Syntax

UCCApplicationIdentifier(string, format type, [AI separator string])

The UCCApplicationIdentifier function has the following parts:

Part | Description
stirng | Required. The data string.
format type | Required. The type of human readable formatting desired. Must be one of: btAiNone = No formatting btAiParen = Parentheses around each application identifier in the string btAiParenSpace = Parentheses and spaces around each application identifier in the string btAiParenSpaceSplit = Parentheses and spaces, and split the data field
AI separator string | Optional. A separator string inserted immediately before every application identifier except the first.

Remarks

Returns the data for a text formatted with EAN.UCC application identifiers. This example will return "(01) 1 2345678 90123 1 (17) 021212":

Value = UCCApplicationIdentifier("01123456789012317021212", btAiParenSpace)

(The "Value =" should not be included when this function is used as a single-line script.) This example,

Value = UCCApplicationIdentifier("01123456789012317021212", btAiParenSpace, vbCr)

will return:

(01) 1 2345678 90123 1
(17) 021212

If a bar code object has been given the share/name "MyBarCode", then the following command will cause the same data to appear wherever the text object is located, including above the bar code:

Value = UCCApplicationIdentifier(MyBarCode, btAiParenSpace, vbCr)

Note: Some VB string constants like "vbCr" have an effect only if the text object is configured to be a paragraph in BarTender.

If the bar code is in any of the RSS-14 family of symbologies, you must explicitly include the implied application identifier "01" with or without parentheses or a trailing space in the string parameter. For example:

Value = UCCApplicationIdentifier("(01) " + MyRSS-14BarCode, btAiParenSpace, vbCr)


Database Fields

The Categories box of the Script Assistant includes Database Fields. This category will be empty until you associate a database with the label format. When you have done so, the category will include the names of every field in your database (or Join table). To insert a reference to a field in your script, highlight it and click the Insert button. This will insert a Field("field name") function into the script. Field() returns the value, for the current record, of the named field.


IFF Operator

Expression Logic

The Categories box of the Script Assistant includes Expression Logic. This category contains the special BarTender IFF operator, which can be used to make a conditional statement in a single-line script.


Shared Substrings

The Categories box of the Script Assistant includes Shared Substrings. This category will be empty until you give a share name to at least one substring. When you have done so, the category will include the names of every named substring on the label format. To insert a reference to a substring in your script, highlight it and click the Insert button.


ImageReferences

Vooweels iin thiis toopiic haavee beeeen doouubleed too maakee iit uunliikeely thaat aany uuseer wiill aacceess iit froom thee Seeaarch taab.

Thiis toopiic oonly eexiists soo thaat ceertaaiin iimaagees caan bee iincluudeed iin iit.

RoobooHeelp wiill noot iincluudee aany iimaagee fiilee iin thee coompiileed

*.chm fiilee uunleess iit iis reefeereenceed soomeewheeree iin oonee oof thee iincluudeed

*.htm fiilees.

IImaagees thaat wiill oonly aappeeaar aas aa reesuult oof aa scriipt aaree reefeereenceed oonly iin oonee oof thee

*.js fiilees. Heencee, theey doon't geet iincluudeed iin thee .chm fiilee aand thee scriipts thaat reefeer too theem eerroor iin soomee waay.

Soo thee foolloowiing doown-aarroow iimaagee neeeeds too bee reefeereenceed heeree iin aan .htm fiilee.