Skip to main content

Search

Search

Vbscript To Open Label Format Based On Cust Id

Comments

9 comments

  • Avatar
    Ian Cummings
    Moderator

    VB scripting in BarTender is only able to run within an already opened BarTender document.  What you'll need to do is develop a separate "front-end" application using something like VB.NET to control BarTender via the automation interface.  In this way the form can be designed to take in whatever user inputs are necessary and from that have a hidden BarTender process open up the appropriate label, set data on the label and then print it.

     

    The below white paper, and the "Automating BarTender" help topic in BarTender should get you started:

     

    http://www.bartenderbarcodesoftware.com/label-software/whitepapers/Controlling-Barcode-Label-Software-using-C-Sharp-and-VB.NET(English).pdf

    0
  • Avatar
    Legacy Poster

    Couldn't you work something out with the template selector inside of the label document which is available in version 10.1.  I am working on something similar based upon customer ID numbers in our system when the packing slip is scanned to pick the correct template format.

    0
  • Avatar
    Legacy Poster

    I looked at using templates within one document, and I think it would work except that we have around 200 label formats that we would need to include.  I'm told that there's no limit to the number of templates but opening the label will take a really long time.

     

    The higher-ups here want to keep it in BarTender and not use another application like VB.Net or Access for the front end.  I have the start of something using one label to prompt for the delivery number, do a lookup in the database and run a script.  The script writes a batch file that Commander will run.  It has a command to start bartender with the selected label.   The batch file works if Bartender is closed, but doesn't seem to do anything if bartender is still open with the "main" label.

     

    Is there a way I can use vbscripting to close myself out of bartender?

    0
  • Avatar
    Domingo Rodriguez
    Moderator

    You will need to look into something like objShell.Close for closing the application, but I haven't tested it to see if it will close an existing BarTender process.

    0
  • Avatar
    Ian Cummings
    Moderator

    This post might be of interest to you.  He is using multiple templates under a template selector to give pseudo label selection under a single BarTender document:

     

    http://forums.seagullscientific.com/index.php?/topic/2115-maximum-of-objects-layers-in-design/#entry6606

     

    No a VB script running in a BarTender document cannot be used to kill the BarTender application instance.

    0
  • Avatar
    Legacy Poster

    Can I use a script in one format to open another template programmatically?

    0
  • Avatar
    Ian Cummings
    Moderator

    Not within the same BarTender instance.  In theory you could run a BarTender command line to launch another BarTender instance and load the label you want into that.  However, I wouldn't recommend that you try such a thing.

    0
  • Avatar
    Legacy Poster

    I'm Using BT 10.3 and Excel 2010. I am usin a script that I found from a  Domingo post that reads:

     


     

    dim objConn


     

    dim strConn


     

    dim rs


     

     


     

    strConn =
    "Provider=Microsoft.Jet.OLEDB.4.0;Data
    Source='C:\\Users\L2277588\Documents\.xlsx';Extended
    Properties=""Excel 8.0;HDR=YES;"""


     

    Set objConn =
    CreateObject("ADODB.Connection")


     

    objConn.Open strConn


     

    Set rs = CreateObject("ADODB.Recordset")


     

    Set rs = objConn.Execute("SELECT * FROM
    [Sheet1$] WHERE Pos4-7 = '" & TextPos4-7 & "'")


     

    Value = rs.fields("Thickness")

     

     What I get is the value from the label returns the first line in each column and prints every line in the column.. What I'm looking for, is for it to read the value on the label, search column A and return the equivalent value from column B. Can you be of any assistance


     

    0
  • Avatar
    Ian Cummings
    Moderator

    lathamlee: So this has nothing to do with opening other BarTender documents from within a document using VB script?  Really you should've created a new post.  Any reason why you cannot use BarTender's built in database connection capability using a query prompt to get the records you want to print?  See the below training videos:

     

    http://www.seagullscientific.com/label-software/training-video-(reading-data-from-database).aspx

     

    http://www.seagullscientific.com/label-software/training-video-(selecting-records-from-a-database-at-print-time).aspx

    0

Please sign in to leave a comment.