+ Reply to Thread
Results 1 to 2 of 2

barcode scan and save into file

Hybrid View

mathanraj76 barcode scan and save into... 04-08-2014, 09:52 PM
Tinbendr Re: barcode scan and save... 04-09-2014, 10:04 PM
  1. #1
    Forum Contributor
    Join Date
    10-02-2012
    Location
    malaysia
    MS-Off Ver
    Excel 2016
    Posts
    140

    barcode scan and save into file

    Hi..


    I have done a program in excel file where i have two textbox
    when user scan barcode in textbox1 and textbox2 it show and sent the data into file and clear the textbox..


    But this program when i scan it shows barcode in textbox1 and send the data into file and when i scan barcode into second textbox2 it shows barcode and data into file but into next row but not in same rows..


    I have attached my program file



    Thanks
    Attached Files Attached Files

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,138

    Re: barcode scan and save into file

    There is no lostfocus event for textboxes in VBA.

    When you double_click a control, the Editor will automatically insert a default event. While the cursor is inside this event, you can choose from a list of available events in the upper right dropdown. (You can also choose the control from the left dropdown,)


    Private Sub txtBarcode_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    Dim WS As Worksheet
    Dim NextRow As Long
    
        Select Case Len(Me.txtBarcode.Text)
    
        Case 12
            Set WS = Worksheets("Barcode_Data")
            With WS
                NextRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
    
                Range("A" & NextRow) = txtseqnum.Value
                Range("B" & NextRow) = txtBarcode.Value
            End With
            txtseqnum.Value = ""
            txtBarcode.Value = ""
    
        Case Else
            MsgBox "Barcode incorrect", vbInformation, "Barcode scan"
            Me.txtBarcode.SetFocus
            Cancel = True
        End Select
    End Sub
    
    Private Sub txtseqnum_Exit(ByVal Cancel As MSForms.ReturnBoolean)
        If Len(Me.txtseqnum) <> 7 Then
            MsgBox "Seqyunce number incorrect", vbInformation, "Sequence number"
            Me.txtseqnum.SetFocus
            Cancel = True
        End If
    End Sub
    David
    (*) Reputation points appreciated.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Barcode info scan to excel
    By BillyG in forum Excel General
    Replies: 4
    Last Post: 03-22-2013, 03:07 AM
  2. Scan barcode and go to next row
    By dsr301 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-21-2012, 11:33 AM
  3. how to scan a barcode into excel
    By hqradio in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-30-2011, 04:57 PM
  4. Replies: 0
    Last Post: 11-08-2010, 03:13 AM
  5. [SOLVED] barcode scan changes last 2 digits in excel 2003
    By patricklundmark in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-18-2005, 05:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1