(Solved) – VBA Excel – Hiding Saving Window Occuring Every Instance in a For Loop


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

If i Mod 1 = 0 Then
'Application.DisplayAlerts = False
'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

    lr = Range("A" & Rows.Count).End(xlUp).Row   1
    Range("A" & lr).Value = ans

End If
'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)

enter image description here

Leave a Reply

Your email address will not be published. Required fields are marked *