|
Function BuildDeliveryNotef() As String
'On Error GoTo err_handle
BuildDeliveryNotef = ""
BoxCountTotal = 0
CustomTotal = 0
CustomFlag = True
Application.DisplayAlerts = False
Call CreateNewWorkSheet(DeliveryNote_DstSheet)
Call PrepareDeliveryNoteSheet
Application.DisplayAlerts = True
Dim irow As Long, strMsg As String, ibegin_rowno As Long
Call CloseScreenView
ALLSourceCount = GetLastRowIndexAll(Worksheets(DeliveryNote_SrcSheet))
AllLableCount = 0
EXEPath = ThisWorkbook.Path & "\" & "QRCode\QRCode.exe" & " """ & ThisWorkbook.Path & "\DeliveryNote"""
With Worksheets(DeliveryNote_SrcSheet)
.Activate
Dim barcode As String
Dim m_process_time As String
m_process_time = Format(Now, "yyyymmddhhnnss")
ibegin_rowno = 5
For irow = ibegin_rowno To ALLSourceCount
If Worksheets(SpotTicket_SrcSheet).Cells(irow, 2) = "" Then
BuildDeliveryNotef = "line" & CStr(irow) & "product_line is empty."
Exit Function
End If
If Worksheets(SpotTicket_SrcSheet).Cells(irow, 3) = "" Then
BuildDeliveryNotef = "line" & CStr(irow) & "part_no is empty."
Exit Function
End If
If Worksheets(SpotTicket_SrcSheet).Cells(irow, 4) = "" Then
BuildDeliveryNotef = "line" & CStr(irow) & "take_in_qty is empty."
Exit Function
End If
If Worksheets(SpotTicket_SrcSheet).Cells(irow, 5) = "" Then
BuildDeliveryNotef = "line" & CStr(irow) & "qty is empty."
Exit Function
End If
If (((irow - 4) Mod cnt_item_count_per_page) = 0 Or irow = ALLSourceCount) Then
barcode = barcode + MakeDeliveryNoteQRCode(ibegin_rowno, irow, m_process_time)
ibegin_rowno = irow + 1
End If
Next
LabelCountTotal = AllLableCount
EXEPath = EXEPath & " """ & barcode & """"
Dim pid
Dim hProcess
pid = Shell(EXEPath, 0)
If pid <> 0 Then
hProcess = OpenProcess(&H100000, True, pid)
WaitForSingleObject hProcess, -1
CloseHandle hProcess
End If
AllLableCount = 0
ibegin_rowno = 5
For irow = ibegin_rowno To ALLSourceCount
If (((irow - 4) Mod cnt_item_count_per_page) = 0 Or irow = ALLSourceCount) Then
Call ProcessDeliveryNoteDataAndInitTable(ibegin_rowno, irow)
ibegin_rowno = irow + 1
End If
Next
Call OpenScreenView
Dim PrintRange As String
With Worksheets(DeliveryNote_DstSheet)
.Activate
PrintRange = .Range("A1:K" & CStr(AllLableCount * cnt_model_row_count + cnt_model_footer_row_count)).Address
.PageSetup.PrintArea = PrintRange
Call DeliveryNote_PrintOptionConfig
End With
Exit Function
End With
err_handle:
BuildDeliveryNotef = Err.Description
End Function
这段代码运行到位置 m_process_time = Format(Now, "yyyymmddhhnnss") 提示编译性错误:找不到工程或库。
运行在win7 32位,excel2003版本,这段代码都是正常运行,但是系统换成64位 win7+excel2003, 就提示这个错误.
各位老师帮忙看看怎么修改,感谢!
|
|