Print Bartender 10.0 By Using Vb6 Application
Hi all
I'm a newbie for bartender use. Currently I made a template which have 2 barcode and the datasource are Embedded Data.
Now I would like to make a small application by VB6.0 and call Bartender to print this label out.
After checking the related instruction documents I make following script in my application
Dim btApp As BarTender.Application
Dim btFormat As BarTender.Format
Set btApp = CreateObject("Bartender.Application")
btApp.VisibleWindows = btAll --it was successful as I can see the bartender application appear
Set bfFormat = btApp.Formats.Open("C:\VB\Sample.btw", True, "")
--I belive at least the right part should success as the template opened in Bartender application.
--But I'm not sure if the bfFormat object is correct got the result or not
--Because when I try to debug in VB6, I could not find any detail information when I add this variabile in montior.
aa = btFormat.PrintOut(False, False)
--here I got the error message, it was run-time error '91' object variable or with block variable not set
So I guess there must be someing wrong with btFormat object, either it was failed to create when try to get feedback from Open method from Formats, or the PrintOut function must be changed.
Can anyone help to check this issue?
I know that VB6 is very old product, but compare with recent DotNet product, the compiled application is very small and easy to suit for most kinds of Windows plateform.
-
Legacy Poster
★ BarTender Hero ★
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 -
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 -
Legacy Poster
★ BarTender Hero ★
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 -
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 -
Legacy Poster
★ BarTender Hero ★
Ian, thx alot I will study it
0 -
Legacy Poster
★ BarTender Hero ★
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
請登入寫評論。
評論
6 條評論