Broken Macro

lb635934

New Member
Joined
Aug 29, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I have a macro that I have been using for years and has continued to work through the various versions of excel. I recently upgraded to Windows 11 and it stopped working. Everything else associated with this macro has remained the same. When I try to use the macro I get an error that says: 'Component not correctly registered'. I've tried to find the source of the problem and it is probably something simple but I haven't had any luck. Below is the macro code I use. Any thoughts on what is happening?

Sub GetNFF()
Dim db As Database
Dim rs As Recordset
Dim dbLocation As String
Dim Sql As String
Dim PCode As String
Dim vAnew As String
Dim i As Integer
PCode = Cells(5, 1).Value


Sql = "SELECT ADDRESS.FILENO, ADDRESS.LOW, ADDRESS.HIGH, ADDRESS.DIRECTION, ADDRESS.STNAME, ADDRESS.STYPE, ADDRESS.OWNER, ADDRESS.STORIES, ADDRESS.NEEDEDFIRE, DETAIL.P, DETAIL.WARR FROM ADDRESS INNER JOIN DETAIL ON ADDRESS.FILENO = DETAIL.FILENO WHERE (((ADDRESS.NEEDEDFIRE) Is Not Null) AND (DETAIL.LINENO)='" & "001" & "') AND ((ADDRESS.PCODE)='" & PCode & "') AND ((Val([P]))<=8) ORDER BY Val(ADDRESS.NEEDEDFIRE) DESC;"


dbLocation = "C:\ISRBdata\SLCDATA.MDB"
Set db = DBEngine.Workspaces(0).OpenDatabase(dbLocation)
Set rs = db.OpenRecordset(Sql)

vAnew = Sheets("Page 2").Cells(7, 3).CopyFromRecordset(rs, 40)
For i = 0 To vAnew - 1
Cells(7 + i, 11).Value = Val(Cells(7 + i, 11).Value)
Cells(7 + i, 10).Value = Stories(Cells(7 + i, 10).Value)

Next


Sheets("Page 2").Activate
rs.Close
db.Close

End Sub
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,214,584
Messages
6,120,385
Members
448,956
Latest member
JPav

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top