And adding a short inputbox for the server is cool if your centrally managing multiple servers.
srvname = InputBox ( "Enter the Server Name", "Server", "xxxxxx")
' making the connection to your sql server
' change yourservername to match your server
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.Recordset")
' this is using the trusted connection if you use sql logins
' add username and password, but I would then encrypt this
' using Windows Script Encoder
"Provider = SQLOLEDB;Data Source=" & srvname & " ;" & _
And this little addition formats the CPUTime column so that you can sort the column afterwards:
objExcel.Cells(i, 7).Value = FormatNumber(objRecordset.Fields.Item("CPUTime"), 0, -1, 0, 0)
Otherwise a cool piece of code. I don't have the time to get into coding much these days, but that might change.
Searching the KB articles is like
picking your nose. You never know
what you'll find.