Class Not Registered Error?

ai1094

Board Regular
Joined
Aug 23, 2018
Messages
92
Hi, I have an Excel Workbook that is using Power Query to take 3 excel files and append them into one report. I have a VBA code that opens those 3 excel files which are connected to a SharePoint site and refreshes them to capture any modifications made to any of the entries. The issue is, the code works perfectly fine for me, but when my colleague runs it on his machine, he receives the following error message: Run-time error '1004': Class not registered

Anyone able to tell me why this is happening?

Here is my code and I've highlighted red bold to show where the code breaks for the other user:

Private Sub Workbook_Open()

'Refresh 1

Workbooks.Open Filename:="some/path/name"
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
ActiveWorkbook.Close SaveChanges:=True

'Refresh 2

Workbooks.Open Filename:="some/path/name"
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
ActiveWorkbook.Close SaveChanges:=True

'Refresh 3

Workbooks.Open Filename:="some/path/name"
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
ActiveWorkbook.Close SaveChanges:=True

' Refresh All


ActiveWorkbook.RefreshAll

*Code breaks here and user receives the following message: Run-time error '1004': Class not registered*


End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)

ActiveWorkbook.Save

End Sub
 
Last edited:

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
1004 is usually not found. Activework to me means the current one, yet you have just opened and closed three, can you set focus on the one that should be active then refresh. either that or i am thinking a path name issue
 
Upvote 0
I just don't understand because on my machine it works perfectly fine. And it used to work for the other user as well, but he just started experiencing this issue.

1004 is usually not found. Activework to me means the current one, yet you have just opened and closed three, can you set focus on the one that should be active then refresh. either that or i am thinking a path name issue
 
Upvote 0

Forum statistics

Threads
1,214,648
Messages
6,120,726
Members
448,987
Latest member
marion_davis

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