'Use the SQL DMO Application Object to find the available SQL Servers Dim oSQLServerApp As Object, namX As Object Dim nIndex As Integer Set oSQLServerApp = CreateObject("SQLDMO.Application") If oSQLServerApp Is Nothing Then Exit Sub Set namX = oSQLServerApp.ListAvailableSQLServers For nIndex = 1 To namX.Count Debug.Print namX.Item(nIndex) Next Set namX = Nothing Set oSQLServerApp = Nothing
Dim oSQLServerApp As Object, namX As Object
Dim nIndex As Integer Set oSQLServerApp = CreateObject("SQLDMO.Application")
If oSQLServerApp Is Nothing Then Exit Sub Set namX = oSQLServerApp.ListAvailableSQLServers
For nIndex = 1 To namX.Count
Debug.Print namX.Item(nIndex)
Next
Set namX = Nothing
Set oSQLServerApp = Nothing