A loading and unloading of logistics, the function I use EXCEL format, the condition of data validity and VBA has finished, now want to ask VB to do, also please help to think about it, before used VB, also please speak when too detailed to best in detail, thank you! Requirements are as follows:
Preparation: 1. The bar code scanning guns
2. Format of barcode, such as
A123456001 , the former seven batch number fixed, four for the serial number after
Operating procedures
1. The first sweep the correct barcode, such as clean the display A123456001, take seven before batch number for the standard, and fixed according to the standard;
2. Start a large number of scanning barcode, seven for
A123456 just judgment is correct;
(3) and the back to three digits
4. Not repeatable and behind the three figures,
5.
2/3/4 article appeared when the situation is not correct, refer to an audio alarm hint,
6. The count of 1, all for the right barcode record, and at the end to EXCEL form;
7. Count 2, display is to the right and do not repeat the number of bar code,
Should be like this, thanks again!
CodePudding user response:
Use a dictionary object solution to weight problems,
CodePudding user response:
Looked at half a day. I didn't understand the sequence is four or three
CodePudding user response:
refer to the second floor small muted response: looked at half a day. I didn't understand the sequence is four or three Should be 0001, less a zero, CodePudding user response:
reference 1/f, zhao teacher reply: use a dictionary object solution to weight problems, Can spread about yao, thank you. CodePudding user response:
A Dictionary object Description Keywords and object, used to store data entry to, Syntax Scripting. The Dictionary Description Dictionary object with a PERL associative array equivalent, can be any form of data entries are stored in arrays, each entry is associated with a unique key, the key used to retrieve a single item, is usually an integer or a string, any type, may be a divisor group The following code illustrates how to create a Dictionary object: Dim d 'create a variable The Set d=CreateObject (Scripting. The Dictionary) Da dd "a", "native" 'add some keywords and entry Belgrade da dd "b", " Da dd "c", "Cairo ". The Add method (Dictionary) Description Add a pair of corresponding keywords and entry to the Dictionary object, Syntax Object. The Add key, item The Add method of grammar has the following several parts: Part of the description Object required, the name of a Dictionary Object, Key required, with the added item associated keywords, Item required, with the added keywords associated items, Description If the key already exists, produces an error, CodePudding user response:
Establish an input box in vb, scanner scans on the screen will automatically send the return, after then began after analysis judgment in vb keypress enter processing, the most basic if statements mids, left string functions, such as you will know, processed an empty box, Private Sub Text1_KeyPress (KeyAscii As Integer) If KeyAscii=13 Then MsgBox "processing" & amp; Text1. Text 'with the if the else process your 2/3/4 string functions, such as written in the basic your VBA code can reuse Text1. Text processed to empty="" ' End the If End Sub CodePudding user response:
refer to 6th floor sysdzw response: in vb to establish an input box, on the scanner scans the screen will automatically send carriage return after, then judge in vb keypress return after analysis and processing, the most basic of the if statement mids, left string functions, such as you will know, processed an empty box, Private Sub Text1_KeyPress (KeyAscii As Integer) If KeyAscii=13 Then MsgBox "processing" & amp; Text1. Text 'with the if the else process your 2/3/4 string functions, such as written in the basic your VBA code can reuse Text1. Text processed to empty="" ' End the If End Sub Moderator: hello, become in VBA code Only some applicable, other function I am using EXCEL "data validity" inside "and" conditional formatting "fix, VBA code is as follows: Private Sub Worksheet_Change (ByVal Target As Range) If Target. Count & gt; 1 Then the Exit Sub If the Target. The Column & lt;> 1 Or Target. Row & lt; 2 Then Exit Sub Dim bz $ Bz=[c2] Value Target. Offset (0, 1)=Left (Target) Value, 7) If Left (Target) Value, 7) & lt;> Bz Then Target. Offset (0, 1). The Font. ColorIndex=3 Call PlayWAV End the If End Sub But to put all together, it is beyond my ability, Thank you very much! CodePudding user response:
reference 5 floor zhao4zhong1 reply: Dictionary object Description Keywords and object, used to store data entry to, Syntax Scripting. The Dictionary Description Dictionary object with a PERL associative array equivalent, can be any form of data entries are stored in arrays, each entry is associated with a unique key, the key used to retrieve a single item, is usually an integer or a string, any type, may be a divisor group The following code illustrates how to create a Dictionary object: Dim d 'create a variable The Set d=CreateObject (Scripting. The Dictionary) Da dd "a", "native" 'add some keywords and entry Belgrade da dd "b", " Da dd "c", "Cairo ". The Add method (Dictionary) Description Add a pair of corresponding keywords and entry to the Dictionary object, Syntax Object. The Add key, item The Add method of grammar has the following several parts: Part of the description Object required, the name of a Dictionary Object, Key required, with the added item associated keywords, Item required, with the added keywords associated items, Description If the key already exists, produces an error, Sorry, this is not how to use, also can't understand how integrates with other conditions, still hope comment CodePudding user response:
Private Sub Text1_KeyPress (KeyAscii As Integer) If KeyAscii=13 Then 'MsgBox "processing" & amp; Text1. Text 'with the if the else process your 2/3/4 string functions, such as written in the basic your VBA code can reuse Dim bz $, Bz="A123456 "If Left (Text1. Text, 7) & lt;> Bz Then Call PlayWAV The else Text1. Tag=Text1. Tag & amp; Text1. Text & amp; VBCRLF End the If Text1. Text processed to empty="" ' End the If End Sub In all processing after the completion of the save Text1. The content of the tag You learn simple and not difficult, if every code expect others to write that's not discuss the problem, this call contract awarding, needs others to complete, CodePudding user response:
The original poster wants to use VB6 to do, or to use Excel VBA to do? To tell the truth, no matter which environment to do with the above, is very simple, CodePudding user response:
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull