Attribute VB_Name = "Module1" ' *************************************************************************** ' Copyright (C) 1991-2003 SQLDev.Net ' ' $BeginHeader$ ' ' @file@: ListAvailableSQLServers.bas ' @author@: Gert E.R. Drapers (GertD@SQLDev.Net) ' @description@: Example: Enumerate SQL Server instances ' @remarks@: ' @created@: 2003-03-02 ' @lastsaved@: 2003-03-02 ' ' update history: ' @version@ @initials@ @updatedate@ @release@ @description@ ' 00000 GED 2003-03-02 v1.0.0.0 created ' ' @EndHeader@ ' *************************************************************************** Option Explicit Public Sub main() On Error GoTo errHandler Dim oApplication As SQLDMO.Application Set oApplication = New SQLDMO.Application If oApplication Is Nothing Then Exit Sub Dim i As Integer For i = 1 To oApplication.ListAvailableSQLServers.Count Debug.Print oApplication.ListAvailableSQLServers.Item(i) Next Set oApplication = Nothing Exit Sub errHandler: Debug.Print Err.Number & " " & Err.Description Resume Next End Sub