Option Explicit
Dim btFormat As BarTender.Format
Dim btApp As BarTender.Application
Private Sub Form_Unload(Cancel As Integer)
btFormat.Close btDoNotSaveChanges
btApp.Quit btDoNotSaveChanges
Set btFormat = Nothing
Set btApp = Nothing
End Sub
Private Sub txtBarcode_KeyPress(KeyAscii As Integer)
On Error GoTo err1
If KeyAscii >= 97 And KeyAscii <= 122 Then
KeyAscii = KeyAscii - 32
End If
If KeyAscii = 13 Then
'ゴ兵絏
Call PrintBarcode(txtBarcode.Text)
End If
Exit Sub
err1:
MsgBox "祘钵盽叫羛么恨瞶", vbCritical
End Sub
Private Sub PrintBarcode(ByVal snBarcode As String)
Dim bartenderFileName As String
bartenderFileName = App.Path & "\" & "1.btw"
Set btApp = New BarTender.Application
Set btFormat = btApp.Formats.Open(bartenderFileName, False, "")
With btFormat
.SetNamedSubStringValue "SN", snBarcode
.Activate
.PrintOut False, False
End With
End Sub
我是初学者,那应该怎麼定义BarTender,怎麼修改代码呢?
追答这是个自定义的私有类,需要看需要解决啥问题来设置。
VB初学者VB一般不会先接触对象类建立。
至于如何建立对象类,建议安装MSDN6.0,从VB参考文档查看建立对象。请阅读上传的附件。
谢谢你的解答,十分感谢
来自:求助得到的回答