最後到了那裏。這適用於我的ActiveX作業下:
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Dim oConnection, oRegistry, sConnectionString, sPlsqlCall, sRegistryKey, sValueName, sParam1, sParam2
' Get connection string from registry
Set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
sRegistryKey = "Software\OracleConnectionString"
sValueName = "Value"
oRegistry.GetStringValue HKEY_CURRENT_USER, sRegistryKey, sValueName, sConnectionString
' Set up PLSQL query
sPlsqlCall = "my_package.my_procedure(" & sParam1 & ", " & sParam2 & ")"
' Call PLSQL
Set oConnection = CreateObject("ADODB.Connection")
oConnection.ConnectionString = sConnectionString
oConnection.Open
oConnection.Execute sPlsqlCall
oConnection.Close
Set oConnection = Nothing
Set oRegistry = Nothing