Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
551 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Hi there,
My coworker and I were running into an error, Run-time error '-2147217865 (80040e37)': Automation error, when we hit the rs.open line. We both tried posting the code in the comments of the YouTube video, but they never seemed to stick. Below is the full code we are using.
Thanks so much in advance for any help with this!
Christina
Dim MyFilesPath As String
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Sheet1.Range("A1").CurrentRegion.Offset(1, 0).Clear
MyFilesPath = "G:\TR\DATA_TEAM_REPORTS&QC\PerryC"
Set cn = New ADODB.Connection
cn.ConnectionString = _
"Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & MyFilesPath & "DupeIMBTest - CP Edit.xlsx;" & _
"Extended Properties='Excel 12.0 Xml;HDR=YES';"
cn.Open
Set rs = New ADODB.Recordset
rs.ActiveConnection = cn
rs.Source = _
"SELECT * FROM [Sheet1$] " ' _
' & "WHERE [Acronym] = 'NWW' AND [Job] LIKE 'Weekly%'"
rs.Open
Sheet1.Range("A2").CopyFromRecordset rs
Sheet1.Range("A1").CurrentRegion.EntireColumn.AutoFit
rs.Close
cn.Close
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.