Mit VBA prüfen, ob Server-DSN existiert
VBA - prüfen, ob Server-DSN existiert
Hi NG,
nochmals eine Frage zum Thema System-DSN.
Wie kann ich per VBA prüfen, ob eine System-DSN auf dem Rechner existiert?
Gruß
Andy
Hi NG,
nochmals eine Frage zum Thema System-DSN.
Wie kann ich per VBA prüfen, ob eine System-DSN auf dem Rechner existiert?
Gruß
Andy
Please also mark the comments that contributed to the solution of the article
Content-ID: 157940
Url: https://administrator.de/forum/mit-vba-pruefen-ob-server-dsn-existiert-157940.html
Printed on: May 12, 2025 at 14:05 o'clock
1 Comment
Moin Moin
So in etwa solte das funktionieren:
Gruß L.
So in etwa solte das funktionieren:
On error resume next
Set oShell = WScript.CreateObject("WScript.Shell")
strKeyPath = "SOFTWARE\ODBC\ODBC.INI\"
myDNS = "NameDerGesuchtenDSN" ' <- Hier must du natürluch den Namen deiner DSN angeben
DBName = oShell.RegRead("HKEY_LOCAL_MACHINE\" & strKeyPath & myDNS & "\Database")
if DBName <>"" Then
wscript.echo "DSN: " & myDNS & " existiert."
end if
Gruß L.