andyah

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
Share on Facebook
Share on X (Twitter)
Share on Reddit
Share on Linkedin

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

Logan000
Logan000 Jan 04, 2011 at 09:14:57 (UTC)
Goto Top
Moin Moin

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.