Hello All
Hope you are doing good, I have a very limited knowledge with Excel and VBA, so please help me on below.
I have macro which runs SQL query and bring the data back to excel, I want to see the progression bar or time or any other thing which shows that the macro is still running. My macro is as follows, please do the needful.
Hope you are doing good, I have a very limited knowledge with Excel and VBA, so please help me on below.
I have macro which runs SQL query and bring the data back to excel, I want to see the progression bar or time or any other thing which shows that the macro is still running. My macro is as follows, please do the needful.
Code:
Sub Get_M_AgentDaily()
'
' Dim theQueryText As String
Dim theQueryTextcomp As String
Dim datestamp As String
Dim current_date As Date
ThisWorkbook.Activate
Sheets("SQL").Activate
Sheets("SQL").Select
Range("B3").Select
theQueryText = ""
While ActiveCell.Value2 <> ""
theQueryText = theQueryText + ActiveCell.Value2
ActiveCell.Offset(1, 0).Select
Wend
Sheets("AgentDaily").Select
Range("A5").Select
Range("A5:IV65536").ClearContents
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DRIVER=SQL Server;SERVER=CNWSQLH004P01" & ";APP=" & Fname & ";DATABASE=TAMI;Trusted_Connection=yes;" _
, Destination:=Range("A5"))
.Sql = theQueryText
.Refresh BackgroundQuery:=False
End With
End Sub