Private Function Conectar() as Boolean
On Error GoTo ErrorConexion
If Conexion.State <> adStateOpen Then
Set Conexion = Nothing
Conexion.Open "Provider=sqloledb;" _
& "Data Source=Servidor;" _
& "Initial Catalog=BaseDatos;" _
& "User Id=NombreUsuario;" _
& "Password=Password;"
End If
Conectar = True
Exit Function
ErrorConexion:
Conectar = False
End Function