2016年1月13日 星期三

[AP] 列印標籤

'//從notes透過function列印條碼機的標籤

Sub PrintLabel(DB As NotesDatabase, DocID As String)
Dim IHandle As Long
Dim iErr As Integer
Dim iCopies As Integer
Dim iSelection As Long
Dim szFormat As String
Dim szID As String
Dim szPrinter As String

iHandle = IPSInitialize( DB.Server, DB.FilePath , "")           
If iHandle=0 Then
Messagebox "IPSInitialize 設定錯誤!"
Exit Sub
End If

szFormat = "BarcodeLabel_4"
iErr = IPSOpenFormat( iHandle, szFormat, 0, DB.Server, DB.FilePath )     
If iHandle=0  Then
Messagebox "IPSOpenFormat  設定錯誤!"
IPSTerminate( IHandle)
Exit Sub
End If
iCopies = 1
iSelection = 0
'szPrinter = GetDeviceName(GetDefPrinter)
szPrinter = "Zebra  Z6M (300dpi)"
'szPrinter = "Zebra Stripe 400" change by morris 09/12/2002
iErr = IPSPrintSetup( iHandle , iCopies, szPrinter, 1 )
If iErr <> 0 Then
Messagebox "IPSPrintSetup  設定錯誤!"
IPSCloseFormat( iHandle)
IPSTerminate( iHandle)
Exit Sub
End If


szID = DocID & ";"

iErr = IPSPrint( iHandle, szID, 0 )
If iErr <> 0 Then
Messagebox "IPSPrint  設定錯誤!"
IPSCloseFormat( iHandle)
IPSTerminate( iHandle)
Exit Sub
End If   

IPSCloseFormat( IHandle)
IPSTerminate( IHandle)
'Messagebox "標籤列印完畢", 64, "列印標籤"    


End Sub

沒有留言:

張貼留言