Home > Software engineering > Why don't file has been generated, the printer to print? The code is as follows:
Why don't file has been generated, the printer to print? The code is as follows:
Time:10-09
The Public Function PrintBarcode (printstr As String) As String
Dim m_port As String M_port=ReadIni (" ZEBRA888T ", "port")
Dim arrPrint () As String ArrPrint=Split (printstr, "^")
Open the App. The Path & amp; "\ print. TXT" For the Output As the # 1
'loop to print 'outer loop Dim strPrint () As String StrPrint=Split (printstr, "$") Dim arrLen As Integer ArrLen=UBound (strPrint) - LBound (strPrint) + 1 Dim printstring print content As the String ' Printstring=""
For k=0 To arrLen - 1 Dim strParam () As String StrParam=Split (strPrint (k), "^") 'inner loop 'loop to print
'file character set conversion Dim filename As String, (b) As Byte, S As String Dim ADO_Stream As Object Filename=App. Path & amp; "\ print. TXT" 'please amend for the specific file name 'If Dir (FileName)="" Then Exit Sub ReDim b (FileLen (filename)) The Open filename For Binary As # 1 Get # 1, and b Close # 1 S=StrConv (b, vbUnicode)
The Set ADO_Stream=CreateObject (" ADODB. Stream ")
With ADO_Stream Type=2 . Mode=3 The Charset="utf-8" . Open . WriteText S SaveToFile filename, 2 End With
The Set ADO_Stream=Nothing
FileCopy App. Path & amp; "\ print. TXT", m_port
If Err. Number & lt;> 0 Then ZebraPrint="please make sure the printer port Settings right" 'Err. The Description The Else ZebraPrint="" End the If End the Function