UndwaterExcelWeaver
New Member
- Joined
- Mar 2, 2019
- Messages
- 38
- Office Version
- 365
- Platform
- Windows
Hello. The module below is part of a very large VBA code that draws in data from an exported file. When we upgraded to Excel 2013/365 this no longer works and gets hung up at the "rs.open" line. Can you tell me what has changed and what I need to change to get this to move forward again past this point? I do not know VBA very well at all. These were written long before my time with my company and I'm just trying to make them functional again. Thanks
Private Sub GetResultSet( _
ByRef rs As ADODB.Recordset, _
ByVal cn As ADODB.Connection, _
ByVal strSQL As String _
)
rs.CursorLocation = adUseClient
rs.Open strSQL, cn, adOpenForwardOnly, adLockReadOnly, adCmdText
On Error GoTo 0
If rs Is Nothing Then
MsgBox "Can't open the file!", vbExclamation, ThisWorkbook.Name
Exit Sub
End If
End Sub
Private Sub GetResultSet( _
ByRef rs As ADODB.Recordset, _
ByVal cn As ADODB.Connection, _
ByVal strSQL As String _
)
rs.CursorLocation = adUseClient
rs.Open strSQL, cn, adOpenForwardOnly, adLockReadOnly, adCmdText
On Error GoTo 0
If rs Is Nothing Then
MsgBox "Can't open the file!", vbExclamation, ThisWorkbook.Name
Exit Sub
End If
End Sub