I am using a Honeywell scanner to input a string of numbers into an excel file, and applying a timestamp when a scan is performed. This excel database is connected to PowerBI Desktop, and so in order to have a live count, I need to save the file after each scanning instance. To do this I use the following code:
'Application.DisplayAlerts = False For i = 1 To 3 StartHandler: If i Mod 1 = 0 Then 'Application.DisplayAlerts = False ActiveWorkbook.Save 'Application.DisplayAlerts = True End If ans = InputBox("Please Scan Pad-Pak Box", "Data Entry Form") If ans = "" Then MsgBox ("Scan was unsuccessful, please try again") GoTo StartHandler Else lr = Range("A" & Rows.Count).End(xlUp).Row 1 Range("A" & lr).Value = ans End If Next 'Application.DisplayAlerts = True
The code works as intended except that the saving window shows up everytime I scan. I have (as per the code) tried to use
application.displayalerts = false and placed it inside and outside the For loop but it didn’t work for either. Any tips?
Goal: To perform the macro whilst hiding the saving window (shown below)