连续两天失败。我正在使用条形码系统,它有条形码扫描器扫描字母数字文本的条形码并将其放入ActiveX文本框。它一次输入一个字母的文本,并在完成整个条形码后,它匹配案例选择,然后删除框中的文本以准备下一次扫描。
我碰巧遇到的问题是在文本框内。无论出于何种原因,文本进入文本框并偶尔〜(1小时内1次或8小时内0次)将无法完成案例。文本框内与其中一个案例匹配的确切文本不计算在内并保留在框内。此时,任何将来的扫描都会附加到框内文本的末尾。
以下是基于案例选择的变量,案例和其中一个事件的示例。
变量
Private Sub TextBox1_Change()
Dim ws As Worksheet, v, n, t, b, c, e, f, h, j, k, i1, i2, i3, i4
Set ws = Worksheets("Sheet1")
v = TextBox1.Value
n = 0
t = 0
b = 0
c = 0
e = 0
f = 0
h = 0
j = 0
k = 0
i1 = 0
i2 = 0
i3 = 0
i4 = 0
案例
Select Case v
Case "2 in x 16 ft R -1": n = 9
t = 1
b = 10
c = 1
e = 11
f = 6
g = "2 in x 16 ft"
h = 40
j = 0.296
k = 1
基于案例类型
完成的东西'n = Sets the column reference for waste - not used?
't = Sets the cutting station column to be used (1,2,3) for the sq yards, row, and column of last scanned item for each station
'b = Sets the row reference for adding cut rolls waste + regular row reference for cut rolls
'c = Sets the column reference for adding cut rolls waste + regular column refernce for cut rolls
'e = Sets the column reference for taking 1 master roll out
'f = Sets the row reference for taking 1 master roll out
'g = name of the item being used for the time stamp
'h = Number of rolls coming out of the master roll
'j = The amount of Sq yards in the cut roll (to be used for waste)
'k = Case Selection
'i1 = Count for Cutting Station 1 timestamp, row reference
'i2 = Count for Cutting Station 2 timestamp, row reference
'i3 = Count for Cutting Station 3 timestamp, row reference
'i4 = Count for Cutting Station 1 timestamp, row reference - not used in this worksheet
If k = 1 And t = 1 Then
'Cutter 1 items
ws.Cells(1, t) = b
ws.Cells(2, t) = c
ws.Cells(3, t) = j
ws.Cells(4, t) = b
ws.Cells(5, t) = c
ws.Cells(6, t) = f
ws.Cells(7, t) = h
ws.Cells(b, c) = ws.Cells(b, c) + h
' adding different number based on case
ws.Cells(f, e) = ws.Cells(f, e) - 1
' always subtracts 1 from certain range based on case
i1 = ws.Cells(1, 30)
Cells(i1, 19).Value = Format(Now, "mm/dd/yyyy AM/PM h:mm:ss")
Cells(i1, 20).Value = g
TextBox1.Activate
TextBox1.Value = ""
请记住,文本一次输入一个字符,直到整个条形码信息传递到ActiveX文本框中。
我可以设置最大长度,但在最大长度时它会保留在文本框中。如果我将文本框设置为"",条形码中的下一个字符将再次开始,并且追加问题将继续。
有没有办法在每个单个字符输入时没有开始选择案例?有没有办法让文本框删除额外的信息。如果将其设置为删除与案例不匹配的内容,则会删除输入的任何内容,因为它一次放入一个字符。
致以最诚挚的问候,
福特