Share via

VBA ListObject..Refresh BackgroundQuery:=False not working in Excel O365 (version 1808)

Anonymous
2019-01-08T10:49:42+00:00

I recently upgraded from Excel 2013 to O365 Version 1808 (Build 10730.20262) - https://docs.microsoft.com/en-us/officeupdates/semi-annual-channel-targeted-2018.

I am now unable to use the VBA code  ListObject..Refresh BackgroundQuery:=False  to refresh queries in background without changing the query properties.

As a test, I have created a query with the following M code:

// Query1

#table(type table[LastRefresh=datetime], {{DateTime.LocalNow()}})

I have tried to refresh this with the below VBA:

Sub test()

    Dim tbl As ListObject

    Set tbl = ActiveWorkbook.ActiveSheet.ListObjects("Query1")

    tbl.Refresh BackgroundQuery:=False

End Sub

The error message received is:

   Compile error: Wrong number of arguments or invalid property assignment.

Any suggestions? This appears to be a bug with Excel as I cannot find any notes that the property was removed.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Lz365 38,201 Reputation points Volunteer Moderator
2019-01-08T11:44:28+00:00

Hi Andrew

Sub test()

    Dim tbl As ListObject

    Set tbl = ActiveWorkbook.ActiveSheet.ListObjects("Query1")

    tbl**.QueryTable**.Refresh BackgroundQuery:=False

End Sub

works better?

Was this answer helpful?

7 people found this answer helpful.
0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Lz365 38,201 Reputation points Volunteer Moderator
    2019-01-08T12:25:54+00:00

    You're welcome & Thanks for posting back

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2019-01-08T11:56:33+00:00

    Perfectly, thank you.

    Was this answer helpful?

    0 comments No comments