Scanning barcodes into VBA InputBox issues

daffyduck1970

New Member
Joined
Jun 8, 2024
Messages
1
Office Version
  1. 365
Platform
  1. MacOS
Long time listener, first time poster. I have a barcode scanner that will scan barcodes properly (anywhere from 3-30 characters long) and enter that data correctly in a cell. Now when I create a simple VBA InputBox and scan the barcode, I get about 65% of what I need in the spreadsheet. I've tried different variations of the InputBox, but I still do not get all of my data. I manually scan into a cell and boom, all the data is there. Is this a VBA issue? Scanner issue? My code issue? Am I pulling an ID10T?

Sub Input1()
Dim AddName As String
AddName = InputBox("Scan Your Name Here", "Add Name")
Range("A1").Value = AddName
End Sub
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
I have faced no major issues scanning barcodes.
Although I have never used InputBox for this. I have scanned in a cell or a textbox on a userform.
Normally the problems come from the communication with the scanner and it's settings.
Normally it worked best for me when:
- data is passed simulating keystrokes (slowest but most reliable)
- scanner does not try to resolve duplicates
- scan is initiated manually (e.g. only scan when a button is pressed), not automatic scan of anything anytime
- the scanner is a real scanner - not a cell phone camera and software simulation of a scanner

65% of what - 65% of the scanned code or 65% of all codes you scan? Can you give an example? Is it always the same 65%?
Is it possible something in the code to simulate the pressing of an enter key? Do you have spaces or tabs or something too special for a barcode. Especially if simulating keystrokes.
I believe avoiding spaces and special characters in the barcode may improve the results.

For the sake of debugging - write AddName to more than 1 cell, or make sure A1 is not the active cell.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,195
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top