I have the following VBA that I wrote a while ago to display to the user that, on the button press, the data is being updated and finally show the date/time when the data was last refreshed.
Private Sub CommandButton1_Click()
Application.StatusBar = "Working on it!!"
Sheet1.Range("LastUpdateDate").Value = "Getting data..."
ActiveWorkbook.RefreshAll
Application.StatusBar = "Done!!"
Application.Cursor = xlNormal
Application.Wait (Now + #12:00:02 AM#)
Application.StatusBar = False
Sheet1.Range("LastUpdateDate").Value = "Last updated: " & Now
End Sub
This is fine if the query is fairly quick, but if the query takes a while (and especially if its a background query) the end message can show when the query is still running.
I'm wondering if its possible to get the message from the status bar ("Running Background Query...") and display it in "LastUpdateDate" until the query has completed?