Anybody have any feedback on how I can fix this code?
I can seem to make it fly...
Patrick.Kenney@LVVWD.com

Standard Module Code:
Sub Main()

Dim objDSN As CCreateDsn
Set objDSN = New CCreateDsn

objDSN.Description(1) = "Development"
objDSN.DataSourceName(1) = "Development"
objDSN.DriverName(1) = "Microsoft ODBC for Oracle"
objDSN.Driver(1) = "C:\WINNT\System32\msorcl32.dll"
objDSN.PWD(1) = "password"
objDSN.Server(1) = "Test"
objDSN.UID(1) = "pk"
objDSN.DSN(1) = "Test"

Call objDSN.MessageOne

End Sub

Class Module Code:

Option Explicit

Private Const REG_SZ = 1
Private Const HKEY_LOCAL_MACHINE = &H80000002

'The RegCreateKey function creates the specified registry key.
'If the key already exists, the function opens it.
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias _
"RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, _
phkResult As Long) As Long

'The RegSetValueEx function sets the data and type of a specified
'value under a registry key.
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias _
"RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, _
ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal _
cbData As Long) As Long

'The RegCloseKey function releases a handle to the specified registry
key.
Private Declare Function RegCloseKey Lib "advapi32.dll" _
(ByVal hKey As Long) As Long

'Private member variables to encapsulate properties
Private m_DataSourceName(1 To 10) As String
Private m_Description(1 To 10) As String
Private m_DriverPath(1 To 10) As String
Private m_DriverName(1 To 10) As String
Private m_UID(1 To 10) As String
Private m_Server(1 To 10) As String
Private m_PWD(1 To 10) As String
Private m_DSN(1 To 10) As String

Property Get DataSourceName(Optional intIndex1 As Integer = 1) As String
DataSourceName = m_DataSourceName(intIndex1)
End Property

Property Let DataSourceName(Optional intIndex1 As Integer = 1, ByVal strDataSourceName
As String)
'Check for subscript out of range error
If intIndex1 < LBound(m_DataSourceName) Or intIndex1 > UBound(m_DataSourceName)
Then
Err.Raise 9 'Subscript out of range
'Raise an error if an invalid assignment is attempted
If strDataSourceName = "" Then Err.Raise 5 'Invalid procedure call
or argument
'Else store in the Private member variables
m_DataSourceName(intIndex1) = strDataSourceName
End If
End Property

Property Get Description(Optional intIndex2 As Integer = 1) As String
Description = m_Description(intIndex2)
End Property

Property Let Description(Optional intIndex2 As Integer = 1, ByVal strDescription
As String)
If intIndex2 < LBound(m_Description) Or intIndex2 > UBound(m_Description)
Then
Err.Raise 9
If strDescription = "" Then Err.Raise 5
m_Description(intIndex2) = strDescription
End If
End Property

Property Get Driver(Optional intIndex3 As Integer = 1) As String
Driver = m_DriverPath(intIndex3)
End Property

Property Let Driver(Optional intIndex3 As Integer = 1, ByVal strDriverPath
As String)
If intIndex3 < LBound(m_DriverPath) Or intIndex3 > UBound(m_DriverPath)
Then
Err.Raise 9
If strDriverPath = "" Then Err.Raise 5
m_DriverPath(intIndex3) = strDriverPath
End If
End Property

Property Get DriverName(Optional intIndex4 As Integer = 1) As String
DriverName = m_DriverName(intIndex4)
End Property

Property Let DriverName(Optional intIndex4 As Integer = 1, ByVal strDriverName
As String)
If intIndex4 < LBound(m_DriverName) Or intIndex4 > UBound(m_DriverName)
Then
Err.Raise 9
If strDriverName = "" Then Err.Raise 5
m_DriverName(intIndex4) = strDriverName
End If
End Property

Property Get UID(Optional intIndex5 As Integer = 1) As String
UID = m_UID(intIndex5)
End Property

Property Let UID(Optional intIndex5 As Integer = 1, ByVal strUID As String)
If intIndex5 < LBound(m_UID) Or intIndex5 > UBound(m_UID) Then
Err.Raise 9
If strUID = "" Then Err.Raise 5
m_UID(intIndex5) = strUID
End If
End Property

Property Get Server(Optional intIndex6 As Integer = 1) As String
Server = m_Server(intIndex6)
End Property

Property Let Server(Optional intIndex6 As Integer = 1, ByVal strServer As
String)
If intIndex6 < LBound(m_Server) Or intIndex6 > UBound(m_Server) Then
Err.Raise 9
If strServer = "" Then Err.Raise 5
m_Server(intIndex6) = strServer
End If
End Property

Property Get PWD(Optional intIndex7 As Integer = 1) As String
PWD = m_PWD(intIndex7)
End Property

Property Let PWD(Optional intIndex7 As Integer = 1, ByVal strPWD As String)
If intIndex7 < LBound(m_PWD) Or intIndex7 > UBound(m_PWD) Then
Err.Raise 9
If strPWD = "" Then Err.Raise 5
m_PWD(intIndex7) = strPWD
End If
End Property

Property Get DSN(Optional intIndex8 As Integer = 1) As String
DSN = m_DSN(intIndex8)
End Property

Property Let DSN(Optional intIndex8 As Integer = 1, ByVal strDSN As String)
If intIndex8 < LBound(m_DSN) Or intIndex8 > UBound(m_DSN) Then
Err.Raise 9
If strDSN = "" Then Err.Raise 5
m_DSN(intIndex8) = strDSN
End If
End Property

Sub CreateMsDsn()

Dim Result As Long
Dim KeyHandle As Long

Result = RegCreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\ODBC\ODBC.INI\" &
_
DataSourceName(1), KeyHandle)

Result = RegSetValueEx(KeyHandle, "Description", 0&, REG_SZ, _
ByVal Description(1), Len(Description(1)))

Result = RegSetValueEx(KeyHandle, "Driver", 0&, REG_SZ, _
ByVal Driver(1), Len(Driver(1)))

Result = RegSetValueEx(KeyHandle, "UID", 0&, REG_SZ, _
ByVal UID(1), Len(UID(1)))

Result = RegSetValueEx(KeyHandle, "Server", 0&, REG_SZ, _
ByVal Server(1), Len(Server(1)))

Result = RegSetValueEx(KeyHandle, "PWD", 0&, REG_SZ, _
ByVal PWD(1), Len(PWD(1)))

Result = RegSetValueEx(KeyHandle, "DSN", 0&, REG_SZ, _
ByVal DSN(1), Len(DSN(1)))

Result = RegCloseKey(KeyHandle)

Result = RegCreateKey(HKEY_LOCAL_MACHINE, _
"SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources", KeyHandle)

Result = RegSetValueEx(KeyHandle, Me.DataSourceName(1), 0&, REG_SZ, _
ByVal DriverName(1), Len(DriverName(1)))

Result = RegCloseKey(KeyHandle)

End Sub

Sub MessageOne()

MsgBox "Do You Want A Faster DSN?" & vbCr & _
"Yes To Configure Microsoft DSN For Oracle" & vbCr & _
"No To Configure Oracle DSN For Oracle" & vbCr & _
"Cancel To Quit", vbYesNoCancel, "Create DSN"

If vbYes Then
Call CreateMsDsn
' If vbNo Then
' Call CreateOraDsn
Else
End
End If

End Sub