vba - Excel ActiveX textbox - count characters or change case -
two days of continual failure. using barcode system has barcode scanner scans barcode of alpha-numeric text , places activex textbox. enters text 1 letter @ time, , upon completion of entire barcode, matches case selection, deletes text in box ready next scan.
the issue happen facing inside of textbox. whatever reason, text goes textbox , ~ (1 time in 1 hour or 0 times in 8 hours) not complete case. exact text inside of textbox matches 1 of cases not counted , stays inside box. @ point, future scans appended end of text inside of box.
below sample of variables, case, , 1 of events occuring based on case selection.
variables
private sub textbox1_change() dim ws 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
case
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
stuff done based on case type
'n = sets column reference waste - not used? 't = sets cutting station column used (1,2,3) sq yards, row, , column of last scanned item each station 'b = sets row reference adding cut rolls waste + regular row reference cut rolls 'c = sets column reference adding cut rolls waste + regular column refernce cut rolls 'e = sets column reference taking 1 master roll out 'f = sets row reference taking 1 master roll out 'g = name of item being used time stamp 'h = number of rolls coming out of master roll 'j = amount of sq yards in cut roll (to used waste) 'k = case selection 'i1 = count cutting station 1 timestamp, row reference 'i2 = count cutting station 2 timestamp, row reference 'i3 = count cutting station 3 timestamp, row reference 'i4 = count cutting station 1 timestamp, row reference - not used in worksheet if k = 1 , t = 1 '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 ' subtracts 1 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 = ""
remember text enters in 1 character @ time until entire barcodes information passed activex textbox.
i can set max length, upon max length stays in textbox. if set textbox "", next character in barcode starts again , append issue continues.
is there way not have case selection start upon entry of each single character? there way have textbox delete information. if set delete not match case, delete entered since puts 1 character in @ time.
best regards,
ford
Comments
Post a Comment