Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ezhov-da/fa3e14c43352fd1349a3716aea763684 to your computer and use it in GitHub Desktop.
Save ezhov-da/fa3e14c43352fd1349a3716aea763684 to your computer and use it in GitHub Desktop.
vba получение списка доступных подключений
Public Sub qwqw()
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\ODBC\ODBC.INI\ODBC Data Sources"
objRegistry.EnumValues HKEY_CURRENT_USER, strKeyPath, arrValueNames, arrValueTypes
For i = 0 To UBound(arrValueNames)
strValueName = arrValueNames(i)
objRegistry.GetStringValue HKEY_CURRENT_USER, strKeyPath, strValueName, strValue
a = arrValueNames(i) & " -- " & strValue
Debug.Print a
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment