ralphtrent
Programmer
I am having a problem rediming my array. Here is my code:
Dim Region, strComputer, oshell
Set oshell = CreateObject("wscript.shell"
strComputer = Array("ereplandemoas5"
const HKEY_LOCAL_MACHINE = &H80000002
Region = Array(0,1)
For p = 0 To UBound(strComputer)
wscript.echo strcomputer(p)
Computer = strcomputer(p)
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&Computer&"\root\default:StdRegProv"
if oReg.EnumKey(HKEY_LOCAL_MACHINE, "SOFTWARE\ODBC\ODBC.INI",arrKeys) = 0 Then
i=0
For Each strKey In arrKeys
If Left(strKey,17) = "ersys0dataaccess_" Then
i=i+1
ReDim Preserve Region(i,1)
Region(i,0) = replace(strKey,"ersys0dataaccess_",""
If left(ucase(oshell.regread("HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\"&strKey&"\Driver"
),8) = "C:\WINNT" Then dbms = "MSSQL"
If left(ucase(oshell.regread("HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\"&strKey&"\Driver"
),9) = "C:\SYBASE" Then dbms = "SYBASE"
Region(i,1) = dmbs
End If
Next
End If
call expandArray()
If Err.Number <> 0 Then
getError(Err.Number)
End if
Next
Here is the error:
Subscript out of range Line 16
I know what that means, but I am not sure why I am getting that.
Any help?
Dim Region, strComputer, oshell
Set oshell = CreateObject("wscript.shell"
strComputer = Array("ereplandemoas5"
const HKEY_LOCAL_MACHINE = &H80000002
Region = Array(0,1)
For p = 0 To UBound(strComputer)
wscript.echo strcomputer(p)
Computer = strcomputer(p)
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&Computer&"\root\default:StdRegProv"
if oReg.EnumKey(HKEY_LOCAL_MACHINE, "SOFTWARE\ODBC\ODBC.INI",arrKeys) = 0 Then
i=0
For Each strKey In arrKeys
If Left(strKey,17) = "ersys0dataaccess_" Then
i=i+1
ReDim Preserve Region(i,1)
Region(i,0) = replace(strKey,"ersys0dataaccess_",""
If left(ucase(oshell.regread("HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\"&strKey&"\Driver"
If left(ucase(oshell.regread("HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\"&strKey&"\Driver"
Region(i,1) = dmbs
End If
Next
End If
call expandArray()
If Err.Number <> 0 Then
getError(Err.Number)
End if
Next
Here is the error:
Subscript out of range Line 16
I know what that means, but I am not sure why I am getting that.
Any help?