Skip to main content

Search

Search

Anyone Help Me With Basic Label Print From Script

Comments

7 comments

  • Avatar
    Legacy Poster

    I did find now that I can use:

     

     btFormat.SetNamedSubStringValue "test", "123545"

     

    But still get an error:  The named data source test is not found in the named data source list

     

    I've clicked on the properties of my text object in the abel and selected properties; from there setting data source name to test.  What else do I need to do?

     

     

    0
  • Avatar
    Legacy Poster

    Are you naming the correct field?

     

    [attachment=849:Wrong.bmp]

     

    [attachment=850:Correct.bmp]

    0
  • Avatar
    Legacy Poster

    yes.  In my case, blue from your example is "test" from mine.

    Here is my vba code.

     

    Sub ThisDoesNotWork()
        Dim btApp As BarTender.Application
        Dim btFormat As BarTender.Format
        Set btApp = New BarTender.Application
        Set btFormat = New BarTender.Format
        btApp.Formats.Open ("c:\os\bob.btw")
        btApp.Visible = False
        
        btFormat.SetNamedSubStringValue "test", "123545"

        btApp.ActiveFormat.IdenticalCopiesOfLabel = 1
        btFormats = btApp.ActiveFormat.PrintOut(False, False)
    End Sub

     

    The label prints if I comment out the brformat.setnamedsubstringvalue "test", "12345"

    The error: the named data source test is not found in the named data source list

    0
  • Avatar
    Legacy Poster

    The named datasource is in the label setup, not your VBScript.  Can you attach a copy of your label please.

    0
  • Avatar
    Legacy Poster

    here is my label file

    0
  • Avatar
    Legacy Poster

    Sorry, I can't help you here.  I know when I was playing with the VBScript inside of Bartender there was a point where I used a field in the script that was not on the label.  It required that I add a reference line of code to the script in order for the script to recognize the database field properly.  I wonder if this is a similar issue, If it is I was not able to find anything about sytanx or verbiage that would help on the internet or in BarTenders help menu.

     

    good luck

    0
  • Avatar
    Domingo Rodriguez
    Moderator

    Have you tried using the NamedSubStrings.GetAll() method in order to get a list of all named data sources you've defined in the BT document? Will this give you "test" and "test2" as the named data sources found?

    0

Please sign in to leave a comment.