How To Combine Two Template Into One File Without Messing The Page Setup? フォローする

0
Avatar
Legacy Poster

Hi, I have two bartender templates that I want to print alternately when a condition is met.

1st template contains details of the product and if the product weights at least 20KG, then 2nd Template should also be printed since it contains the heavy lfit logo.

 

Printing is done through an excel file where user can input the product and its details, then a VB script will be triggered when the user clicks the print button.

 

Theoretically, I think, the vb script below should work. But when I tried printing with it, it is not consistent in printing the 2nd template. Sometimes it prints the 2nd template and often times it doesn't.

 

Also, since the no. of copies is tied with one of the fields in the source file, I can't make it to print alternately. So I was thinking that if I can combine the two templates into one, my problem will be solved.

 

 

The VB script for printing looks like this:

'rsTemplate = Template to print

'rsPrinter = Printer IP address

'rsInputfile = CSV file that will be generated by the excel and is the source file of the two templates

 

'Bartender Label Printing
              lsCmd = "C:\Program Files\Seagull\BarTender Suite\BarTend.exe /f=" & rsTemplate(0) & " /prn=" & rsPrinter & " /d=" & rsInputfile & " /p /x"
              lnRet = Shell(lsCmd, vbMinimizedNoFocus)
             
             If lnRet = 0 Then
                Beep
                MsgBox "Label Printing Failed, Please try again!"
                Exit Sub
             Else
                Call Sleep(5 * 1000)
                MsgBox "Label Sent to Printer Successfully. Pls check Printer"
                If grossweight >= 20 Then
                    lsCmd = "C:\Program Files\Seagull\BarTender Suite\BarTend.exe /f=" & rsTemplate(1) & " /prn=" & rsPrinter & " /d=" & rsInputfile & " /p /x"
                    lnRet = Shell(lsCmd, vbMinimizedNoFocus)
                            If lnRet = 0 Then
                                Beep
                                MsgBox "Label Printing Failed, Please try again!"
                                Exit Sub
                            Else
                                Call Sleep(5 * 1000)
                                MsgBox "Label Sent to Printer Successfully. Pls check Printer"
                            End If
                End If
             End If

 

Attached are the templates and the csv data source file:

 

 

 

2 コメント

0
Avatar
Ian Cummings
モデレータ
コメントアクション Permalink

I note that you're using v10.0 SR4.  To me this is the perfect opportunity to use the multi-template feature of BarTender v10.0 which allows you to have multiple layouts per BarTender document.  Find this feature in the "Page Setup" dialog under the "Templates" tab.  You could even set the templates under a template selector which will allow you to conditionally set whether the  additional template should print or not based on some other data value.

 

See the What's New in BarTender v10.0 white paper for some details of this feature:

 

http://www.bartenderbarcodesoftware.com/label-software/whitepapers/WhitePaper_WhatsNewInBT10.pdf

 

I also note that you are not using Seagull drivers for your Zebra printers.  For reasons of performance and reliability I would recommend that you remove the currently installed drivers and instead install ours.

 

http://www.bartenderbarcodesoftware.com/drivers/Zebra-windows-printer-drivers.aspx

0
Avatar
Legacy Poster
コメントアクション Permalink

Hi Ian,

Will try your suggestions!

Thanks.

サインインしてコメントを残してください。