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

(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
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)

enter image description here

Leave a Reply

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