Skip to main content

Search

Search

Print Bartender 10.0 By Using Vb6 Application

Comments

6 comments

  • Avatar
    Legacy Poster

    give some updated info

     

    when I try this method it works

     

    aa = btApp.Formats.Item(0).PrintOut(False, False)

     

    So I guess that the issue should be the return value from Bartender.Application.Formats.Open method

     

    Anyhow it works. So my next step is how to using VB6 code to put the value into this format.

    But if anyone know the error for get return value, welcome to share with me.

    0
  • Avatar
    Ian Cummings
    Moderator

    I'm not sure why you prefix the PrintOut method call with "aa =" as all you need do is call this method with you format object like so: btFormat.PrintOut(False, False)

     

    Note:  Although the example given is in .NET, the below BarTender Help item for the PrintOut() method in the COM (ActiveX) interface should be useful to you.

     

    http://help.seagullscientific.com/10.1/en/#../Subsystems/ActiveX/Content/PrintOut_Method.htm

    0
  • Avatar
    Legacy Poster

    Hi dear Ian

     

      Thx alot for your reply, Frist, the reason for using "aa=" is because without that, the VB6 will report error, maybe it consider the PrintOut method must have a return value and need to store it ;)

     

      To be honest, currently there were 3 ways to realize my request:

      1 -- using my application to generate a txt file, then using Bartender with commmand service mode to monitor some special folder and then automatic pickup the txt file and print.

      2 -- using my application to call Bartender API (just like I asked in previous )

      3 -- using my application to call a shell command.

     

      But I want to know which way is better, and from offically which one is suggested.

      Could you help to check with this?

     

    Thx alot

    0
  • Avatar
    Ian Cummings
    Moderator

    I guess if you don't overload the PrintOut() method call then you won't get the error about storing the result.  Example:

     

    btFormat.PrintOut

     

    If you continue to struggle on the direct programming front, then the use of Commander is a very strong alternative.  See the white paper for more details: http://www.seagullscientific.com/label-software/whitepapers/overview-of-commander-new-201406.pdf

    0
  • Avatar
    Legacy Poster

    Ian, thx alot I will study it

    0
  • Avatar
    Legacy Poster

    I use BarTender in Late-Binding.

    This work perfectly:

     

     

    
        Dim sFile As String
        Const btDoNotSaveChanges = 1
        Dim btFormat As Object ' BarTender.Format
        
        sFile = gsAppPath & "BarTender\Sospesi.btw"
        If Dir(sFile) = vbNullString Then Exit Sub
            
        Dim btApp As Object ' BarTender.Application
        Set btApp = CreateObject("BarTender.Application")
            
        Set btFormat = btApp.Formats.Open(sFile, False, "")
        Call btFormat.PrintOut(False, False)
        
        btApp.Quit btDoNotSaveChanges
        Set btApp = Nothing
     

     

     
     
    Hope you help.
    ;)
    0

Please sign in to leave a comment.