用openschema Dim cnn1 As ADODB.Connection Dim rstSchema As ADODB.Recordset Dim strCnn As String Set cnn1 = New ADODB.Connection strCnn = "driver={SQL Server};server=srv;" & _ "uid=sa;pwd=;database=pubs" cnn1.Open strCnn Set rstSchema = cnn1.OpenSchema(adSchemaTables) Do Until rstSchema.EOF Debug.Print "Table name: " & _ rstSchema!TABLE_NAME & vbCr & _ "Table type: " & rstSchema!TABLE_TYPE & vbCr rstSchema.MoveNext Loop rstSchema.Close cnn1.Close |