Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Query Connection Refresh Error

Hi,

 

Recently i face not consistent error when i refresh (using VBA) one of the tables which are connected to power query.

 

The error i receieve:

"The connection could not be refreshed. This problem could occur if the connection was copied from another workbook or the workbook was created in a newer version of Excel."

 

When i refresh again the table it worked fine. Furthermore, this connection worked fine for a few months till now.

 

VBA code:

Set ddSheet = ActiveWorkbook.Sheets(SheetName)

Set ddTbl = ddSheet.ListObjects(TableName)
Set qt = ddTbl.QueryTable
bgQuery = qt.BackgroundQuery
With qt
     .BackgroundQuery = False
     .Refresh
     .BackgroundQuery = bgQuery
End With

 

Power query version: 2.76.5678.581 64 bit

Excel version: Version 2001 (Build 12430.20264)

 

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

I'm not familiar with VBA code.

It seems this code you provided is to refresh power query,

As tested, there are similar threads to complete this feature in power query:

VBA ListObject..Refresh BackgroundQuery:=False not working in Excel O365

Refresh Power Query With VBA

https://www.mrexcel.com/board/threads/powerquery-macro-refresh.1075922/

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Hi,

 

Thanks for the answer, but this code is running for couple of months just fine,

Also now is running without any problems on other users PC, so i think this is not the problem.

It generate this error only on one user and also not consistent. on several workbooks having different power query tables.

I thought it's something with the office version not up to date but i installed the last update and it stll generating this error.

Anonymous
Not applicable

Still getting this error.

Any ideas?

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors
Top Kudoed Authors