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
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: