Ok, try such tweaking of the code of your workbook:
1. Copy all code shown in post#2 into ThisWorkbook module of your workbook.
2. Copy into MacroPart1 the top part of your MPMDataRefresh code up to the line with ActiveWorkbook.RefreshAll .
3. Copy into MacroPart2 the rest lines of MPMDataRefresh code which are below the line with ActiveWorkbook.RefreshAll
As the result your code of MPMDataRefresh macro now are in two parts, i.e. in MacroPart1 and MacroPart2 macros, and MPMDataRefresh subroutine is not required.
Below is template for MacroPart1 and MacroPart2:
' First stuff with RefreshAll at the end of macro
Sub MacroPart1()
' Part of the code copied from your MPMDataRefresh
' from top up to the line with ActiveWorkbook.RefreshAll
End Sub
' This macro will be called from QT_AfterRefresh code
Sub MacroPart2()
' The rest lines of MPMDataRefresh code
' which are below the line with ActiveWorkbook.RefreshAll
End Sub
It’s assumed that only one query is in your workbook.
For adjusting replace this line of Workbook_Open code: Set QT = Sheet1.QueryTables(1)
by that one: Set QT = Sheets("YourSheetNameWithQuery").QueryTables(1)
Instead of ""YourSheetNameWithQuery"" apply the appropriate sheet name where the query is.
If more than one queries are used or if you stuck then could you provide workbook example with dummy data?
Vladimir